我正在使用php mail()
从我的网站发送电子邮件。但我面临着奇怪的行为。
$headers = "From: Saurabh Sharma <no-reply@example.com>\r\n";
$headers .= 'Reply-To: ' . $email . "\r\n";
$headers .= "Return-Path: me@example.com\r\n";
$headers .= "Organization: Saurabh Sharma\r\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "MIME-Version: 1.0" . "\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
但所有邮件都是垃圾邮件。
另外,我在服务器上添加了一条规则,将每封邮件的副本发送到我在Gmail上的个人邮箱。当我使用php mail()
(垃圾邮件)时,我能够在gmail上收到邮件,但即使收到的地址是我的域名电子邮件地址即me@example.com
,我的服务器上的RoundCube上也看不到任何邮件但我只收到gmail上的副本。
此外,如果我向/从Roundcube发送邮件到我的Gmail,反之亦然,邮件总是落在Gmail的收件箱中,Roundcube也会在收件箱中显示邮件。
但是在mail();
主要问题是me@example.com上没有收到电子邮件,但我可以在Gmail上看到该副本。
我在标题中做错了吗?