PHP邮件功能发送到Gmail和Live,但不发送到我自己的电子邮件



我有一个在旧服务器上运行良好的联系表单的脚本。我们需要在新服务器上移动,现在它只有在我向Gmail或实时地址发送电子邮件时才有效。如果我尝试将电子邮件发送到我自己的电子邮件 assistenzatecnica@actainfo.it,则不起作用。

$from = trim($_POST['email']);
$message = trim($_POST['message']);
$username = trim($_POST['username']);
/*Invia mail*/
$body = '<html><body>';
$body .= '<p><strong>Da:</strong> '.$username.' - '.$from.'</p>';
$body .= '<p>'.$message.'</p>';
$body .= '</body></html>';
$headers = 'From: '.$from.'' . "rn";
$headers .= 'MIME-Version: 1.0' . "rn" .
'Content-type: text/html; charset=utf-8' . "rn" .
'X-Mailer: PHP/' . phpversion();
mail("assistenzatecnica@actainfo.it", "ActaPrivacy - Richiesta Assistenza", $body, $headers);

php.ini 文件与旧服务器中的文件完全相同。服务器是 linux,我保留了默认值

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i

我不知道我还能做什么,奇怪的是,如果我发送到Gmail,它会起作用,那么为什么当我发送到自己的邮件时它不起作用呢?

我已经可以迁移到 PHPMailer,但我也想了解为什么如果它以前工作并且设置相同,它无法正常工作。

請移動到 PHPMailer。默认的 php 邮件函数不支持现代安全功能。您可以看到您在 Gmail 中收到的电子邮件带有红色挂锁图标。某些邮箱永远不会收到不安全的电子邮件。

相关内容

最新更新