ここに私の設定ファイルがあります。メールが送信されました。しかし、受信トレイで受信されません。 PHP - > localhost - > XAMPP - > Webサーバー
sendmail.ini
[sendmail]
; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.
smtp_server=(Correct SMTP Server)
; smtp port (normally 25)
smtp_port=25
php.iniの
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = (Correct SMTP Server)
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = ([email protected](server.com)) <- correct name
PHPコード
<?php
$from_name = "testing";
$from_email = "[email protected]";
$headers = "From: $from_name <$from_email>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$body = "Hi,\nThis is a test mail from $from_name <$from_email>.";
$subject = "Test mail from test";
$to = "[email protected]";
if (mail($to, $subject, $body, $headers)) {
echo "success!";
} else {
echo "fail…";
}
?>
私は、コードを実行したとき、それは確かに電子メールが送信されたと言うが、私は電子メールをチェックすると受け取るものはありません...助けてください!この問題を解決するためにできるだけ多くの関連情報を提供していただきありがとうございます。
大きなドメイン(gmail、aol、yahooなど)に送信していますか?その場合、特定の手順(適切なDNS、IPの非汎用ホスト名)を使用せずにメールを送信すると、スパムスコアが増加します。また、必要な場合は、SMTPサーバーで認証していますか? – drew010
MXレコードが設定されていますか? – blake305
@drew私は、同社のMicrosoft Outlook電子メールに送信しています。認証ユーザーとパスワードが必要ないため、SMTPサーバーで認証されませんでした。 – user127886