垃圾邮件和收件箱中的PHP邮件 [英] PHP mail goes in spam and inbox

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

问题描述

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

  sendEmail('xyz@gmail.com','test subject','test body' xyz name','abc@gmail.com','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 no-reply@xyz.com');
return $ success;

}

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



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

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

解决方案

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



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



使用php邮件功能阻止发送邮件被视为垃圾邮件


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

sendEmail('xyz@gmail.com', 'test subject', 'test body', 'xyz name', 'abc@gmail.com', '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 no-reply@xyz.com');
    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邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆