メールを送信するための PHP スクリプトを作成しました。
私のスクリプトは次のようなものです:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: abc@yahoo.com' . "\r\n";
// Email Variables
$toUser = "someone@yahoo.com"; // recipient
$subject = "testing"; // subject
$body = "<html><body><p>
Example of including an image via html \<img\> tag:
<br>
<img src='../images/profile.jpg'>
<br>
My new picture
<br></p></body></html>"; // content
if (mail($toUser,$subject,$body,$headers)) {
echo "sent";
} else {
echo "failed";
}
もちろん、送信者と受信者に有効な電子メール アドレスを使用します。メールは届きましたが、迷惑メールに振り分けられています。そこで私はグーグルリサーチに行きました。「ヘッダー」スクリプトの問題が原因ですか?そうでない場合、スクリプトが迷惑メールを送信する原因は何ですか? 解決策はありますか?