本文介绍了垃圾邮件和收件箱中的PHP邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

函数sendEmail($ to,$ subject,$ body,$ fromName,$ from,$ format ='')
{
$ headers =''

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

$ headers。=From:$ fromName< $ from> 。 \\\
;

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

}

我的问题是这样,当我发送多个10)邮件然后一些邮件进入垃圾邮件和一些在收件箱。如果脚本错误,那么所有邮件都应该进入垃圾邮件,否则所有邮件都将进入垃圾邮件,否则所有邮件都将进入收件箱。



为什么某些邮件进入垃圾邮件?

而主体,正文,留言和电子邮件(to)是一样的。

解决方案

使用完整标题来避免垃圾邮件






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

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.

Why some mail goes into spam and some in inbox?

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

解决方案

Use full headers to avoid spam

http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/

Prevent sent emails treated as junk mails using php mail function

这篇关于垃圾邮件和收件箱中的PHP邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 12:39