PHP 邮件进入垃圾邮件和收件箱

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20416866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:11:05  来源:igfitidea点击:

PHP mail goes in spam and inbox

phpemailspam

提问by Martin C

I am using simple PHP mail function to send mail. Here is my code:

我正在使用简单的 PHP 邮件功能来发送邮件。这是我的代码:

sendEmail('[email protected]', 'test subject', 'test body', 'xyz name', '[email protected]', 'HTML');

function sendEmail($to, $subject, $body, $fromName, $from, $format = '')
{
    $headers = '';

    if($format=='HTML')
    {
        $headers .= "Content-type: text/html; charset=iso-8859-1\n";
    }

    $headers .= "From: $fromName <$from>" . "\n";

    $success = mail($to, $subject, $body, $headers, '-f [email protected]');
    return $success;

}

My problem is this when i send more than one (like 10) mail then some mail goes into spam and some in inbox. If script is wrong then all mail should go into spam or if right then all mail into inbox.

我的问题是当我发送不止一封(如 10 封)邮件时,一些邮件进入垃圾邮件,一些进入收件箱。如果脚本错误,则所有邮件都应进入垃圾邮件,如果正确,则所有邮件都应进入收件箱。

Why some mail goes into spam and some in inbox?

为什么有些邮件进入垃圾邮件,有些进入收件箱?

while subject, body, message and email(to) is same.

而主题、正文、消息和电子邮件(收件人)是相同的。