Mr.*_*oon 0 php email gmail email-spam spam
我刚开始在我的网站上提供用户帐户(大型PR6网站,声誉良好),我注意到注册电子邮件几乎总是发送到收件人垃圾邮箱.
到目前为止,我们只发了几封电子邮件,所以它不像我们一直在抨击成千上万.
我通过PHP发送电子邮件和mail()函数.您可以在下面找到我使用mail()函数发送的标题.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Domain.com <noreply@mydomain.com>' . "\r\n";
Run Code Online (Sandbox Code Playgroud)
是否有办法或技巧来绕过这些垃圾邮件过滤器?它显然不是我发送的垃圾邮件.注册邮箱包含3个链接.
有很多事情可能导致电子邮件被标记为垃圾邮件.解决方案有两个:一方面你应该使用一个好的smtp服务器(可传递性),然后你应该正确地形成你的电子邮件.(使用mail()的艰巨任务.)
你应该使用像PHPMailer这样的东西.它是一个用于发送电子邮件的PHP库,并且正确地执行它们,因此电子邮件更有可能正确到达.
http://phpmailer.worxware.com/
电子邮件发送可能很头疼,但我可以推荐http://www.sendgrid.com - 您基本上将它们设置为phpmailer的smtp服务器并使用他们的外发邮件服务器..他们是电子邮件传送的专家,你会有一个更容易的时间.特别是当你开始发送成群的电子邮件时.
来自phpmailer网站的电子邮件示例:
<?php
require_once('../class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "smtp.sendgrid.net"; // sets the SMTP server to sendgrid's server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "emailuser@host.com"; // Sendgrid user
$mail->Password = "yourpassword"; // Sendgrid passw.
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
echo !$mail->Send() ? "Mailer Error: " . $mail->ErrorInfo : "Message sent!";
?>
Run Code Online (Sandbox Code Playgroud)
我想说我在任何方面都不隶属于Sendgrid.我只是他们服务的忠实粉丝.我在web开发商店里与mail()函数,smtp服务器,邮件队列和服务进行了多年的战斗,我不希望这个命运成为我最大的敌人.节省一些时间和烦恼.
干杯...