问题描述
我正在尝试使用php发送邮件.我的邮件进入了垃圾邮件,邮件中也出现了其他一些错误.
我的标头代码是
$header_mail="select content from mail_header where id='1'";
$header_mail2=mysql_query($header_mail);
$fet=mysql_fetch_array($header_mail2);
$content= htmlentities($fet['content']);
$Headers = "From:$content\r\n" .
"Reply-To:$content\r\n" .
"Content-type: text/html; charset=UTF-8 \r\n";
$Headers.= "MIME-version: 1.0\n";
$Headers.= "Content-type: text/html; charset= iso-8859-1\n";
$ content中的
数据是zamisoft<zamisoft.com>
,但我收到的邮件与
from: Zamisoft<
回复:Zamisoft< [email protected]& gt
我在邮件中收到了这些消息
请谨慎使用此消息.许多人将类似的消息标记为网络钓鱼诈骗,因此其中可能包含不安全的内容.了解更多信息".
邮件将成为垃圾邮件,并且邮件的标头部分出现错误.
有人帮助我解决这些问题吗?
问题很简单,PHP mail()
函数未使用配置良好的 SMTP服务器.
如今,电子邮件客户端和服务器会对电子邮件发送服务器进行大量检查,例如反向DNS查找,灰名单和whatevs.所有这些测试都将因php mail()
函数而失败.如果您使用的是动态IP,那就更糟了.
使用PHPMailer-Class
并将其配置为使用smtp-auth
以及配置良好的专用 SMTP服务器(本地的或远程的),您的问题就消失了./p>
https://github.com/PHPMailer/PHPMailer
i am trying for send mail using php.My mail go to spam and some other errors are also in mail.
My header code is
$header_mail="select content from mail_header where id='1'";
$header_mail2=mysql_query($header_mail);
$fet=mysql_fetch_array($header_mail2);
$content= htmlentities($fet['content']);
$Headers = "From:$content\r\n" .
"Reply-To:$content\r\n" .
"Content-type: text/html; charset=UTF-8 \r\n";
$Headers.= "MIME-version: 1.0\n";
$Headers.= "Content-type: text/html; charset= iso-8859-1\n";
data in $content is zamisoft<zamisoft.com>
but i got the mail as with
from: Zamisoft<
reply-to: Zamisoft<, [email protected]>
I got the these message in mail
"Be careful with this message. Many people marked similar messages as phishing scams, so this might contain unsafe content. Learn more "
Mail is going to spam and errors are in header section part of mail.
Any body help me for solve these issue?
The problem is simple that the PHP mail()
function is not using a well configured SMTP Server.
Nowadays Email-Clients and Servers perform massive checks on the emails sending server, like Reverse-DNS-Lookups, Graylisting and whatevs. All this tests will fail with the php mail()
function. If you are using a dynamic ip, its even worse.
Use the PHPMailer-Class
and configure it to use smtp-auth
along with a well configured, dedicated SMTP Server (either a local one, or a remote one) and your problems are gone.
https://github.com/PHPMailer/PHPMailer
这篇关于使用PHP将邮件转为垃圾邮件而不是收件箱,并且邮件标题中的某些错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!