1
我已阅读How to remove "via" and server name when sending mails with PHP?,但是在这种情况下它不起作用。如何使用邮件从电子邮件中删除“via”()
我想发送电子邮件至[email protected]
,电子邮件将从[email protected]
发送,使用PHP的mail(),但我这样做的时候,它说via example.prod.ex3.example.net
。考虑到我已经尝试了上述解决方案,我将如何移除该问题?这是我的代码。
<?php
$to = $_POST['to'];
$subject = $_POST['subject'];
$txt = $_POST['msg'];
$headers = "Return-Path: " . $_POST['from'] . "\r\n" . "From: " . $_POST['from'] . "\r\n" .
"CC: ".$_POST['from'];
mail($to,$subject,$txt,$headers);
header('Location: ..');
?>
'From:“。$ _POST ['from']'
您应该避免使用mail()函数;使用已建立的库,例如PHPMailer或Swiftmailer。 – Kaylined