電子メールにスパムのフラグが立てられる原因はたくさんあります。解決策は2つあります。1つは、優れたSMTPサーバー(配信可能性)を使用する必要があり、次に、電子メールを正しく作成する必要があります。(mail()を使用した困難な作業。)
PHPを使用して正しくメールを送信する
あなたは本当にPHPMailerのようなものを使うべきです。これは、電子メールを送信するためのphpライブラリであり、それらを適切に実行するため、電子メールが正しく到達する可能性が高くなります。
http://phpmailer.worxware.com/
メール配信
メール配信は頭痛の種になる可能性がありますが、http://www.sendgrid.comをお勧めします-基本的にはphpmailerのsmtpサーバーとして設定し、送信メールサーバーを使用します。はるかに簡単な時間。特に大量のメールを送信し始めるとき。
コード例
phpmailerのWebサイトからの電子メールの例:
<?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!";
?>
私はSendgridとは一切関係がありません。私は彼らのサービスの大ファンです。私は長年、Web開発ショップでmail()関数、SMTPサーバー、メールキュー、およびサービスと戦ってきましたが、最悪の敵の運命を望んでいません。時間と心配を節約してください。
乾杯...