Centos 6 - Postfix はフラグなしでは自分のドメインに送信しません

Centos 6 - Postfix はフラグなしでは自分のドメインに送信しません

サイトを別のサーバーに移動しているのですが、PHPメールで問題が発生しています。ただし、ホストドメインにメールを送信する場合のみです。例:[メールアドレス]

mail($send_to, 'Web contact' ,$message,null,"-r [email protected]");

メールを送信する唯一の方法は、-r フラグを追加することです。フラグの後に入力される電子メール アドレスは関係ないようです。

これは Centos 5 から 6 への移行であり、メールは現在 sendMail ではなく Postfix を使用していると思います。

メール関数の呼び出しごとにこのフラグを追加する必要がなくなるように変更できる Postfix 設定はありますか?

さらに、これを修正できない場合、Postfix を使用する代わりに sendMail の使用を強制する方法はありますか?

ログに示されているように、メールが内部的にルーティングされていることはわかっていると述べておくべきでした。

編集

これはフラグなしで失敗した試みです

May 14 16:13:12 test sendmail[10244]: t4EFDCLq010244: from=apache, size=169, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
May 14 16:13:12 test postfix/smtpd[10245]: connect from localhost[127.0.0.1]
May 14 16:13:12 test postfix/smtpd[10245]: 9EFB3256738: client=localhost[127.0.0.1]
May 14 16:13:12 test postfix/cleanup[10248]: 9EFB3256738: message-id=<[email protected]>
May 14 16:13:12 test sendmail[10244]: t4EFDCLq010244: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30169, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 9EFB3256738)
May 14 16:13:12 test postfix/qmgr[10102]: 9EFB3256738: from=<[email protected]>, size=592, nrcpt=1 (queue active)
May 14 16:13:12 test postfix/smtpd[10245]: disconnect from localhost[127.0.0.1]
May 14 16:13:12 test postfix/smtp[10249]: 9EFB3256738: to=<[email protected]>, relay=mail.example.com[748.31.105.444]:25, delay=0.1, delays=0.04/0.01/0.01/0.03, dsn=5.0.0, status=bounced (host mail.example.com[748.31.105.444] said: 550-Verification failed for <[email protected]> 550-No Such User Here" 550 Sender verify failed (in reply to RCPT TO command))
May 14 16:13:12 test postfix/cleanup[10248]: B47B625675D: message-id=<[email protected]>
May 14 16:13:12 test postfix/bounce[10250]: 9EFB3256738: sender non-delivery notification: B47B625675D
May 14 16:13:12 test postfix/qmgr[10102]: B47B625675D: from=<>, size=2524, nrcpt=1 (queue active)
May 14 16:13:12 test postfix/qmgr[10102]: 9EFB3256738: removed
May 14 16:13:12 test postfix/smtp[10249]: B47B625675D: to=<[email protected]>, relay=mail.example.com[748.31.105.444]:25, delay=0.03, delays=0/0/0.01/0.02, dsn=5.0.0, status=bounced (host mail.example.com[748.31.105.444] said: 550 No Such User Here" (in reply to RCPT TO command))
May 14 16:13:12 test postfix/qmgr[10102]: B47B625675D: removed

そしてこれは旗と一緒に

May 14 16:13:23 test sendmail[10251]: t4EFDN45010251: Authentication-Warning: example.com: apache set sender to [email protected] using -r
May 14 16:13:23 test sendmail[10251]: t4EFDN45010251: [email protected], size=169, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
May 14 16:13:23 test postfix/smtpd[10245]: connect from localhost[127.0.0.1]
May 14 16:13:23 test postfix/smtpd[10245]: 3B3EF256738: client=localhost[127.0.0.1]
May 14 16:13:23 test postfix/cleanup[10248]: 3B3EF256738: message-id=<[email protected]>
May 14 16:13:23 test postfix/qmgr[10102]: 3B3EF256738: from=<[email protected]>, size=662, nrcpt=1 (queue active)
May 14 16:13:23 test sendmail[10251]: t4EFDN45010251: [email protected], [email protected] (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30169, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 3B3EF256738)
May 14 16:13:23 test postfix/smtpd[10245]: disconnect from localhost[127.0.0.1]
May 14 16:13:24 test postfix/smtp[10249]: 3B3EF256738: to=<[email protected]>, relay=mail.example.com[748.31.105.444]:25, delay=1.4, delays=0.03/0/0.01/1.3, dsn=2.0.0, status=sent (250 OK id=1Ysup9-0001Rr-Jv)
May 14 16:13:24 test postfix/qmgr[10102]: 3B3EF256738: removed

問題は、ユーザー apache が Postfix によってバウンスされていることのようです。理想的には、このユーザーに対して Postfix がとにかく送信するようにしたいです。

Postfixの設定

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = localhost.$mydomain
mydomain = example.com
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

答え1

まず、MTA の 1 つを削除する必要があります。1 つのシステムに 2 つの MTA があると、予期しない結果が生じる可能性があります。私はPostfixしか経験がないので、送信メールを削除する削除すると、mailコマンドはデフォルトのエージェントとして sendmail の代わりに postfix を使用します。

yum remove sendmail

次に、設定できるのはphp.ini のデフォルトの sendmail パラメータsendmail_path パラメータの例

sendmail_path = '/usr/sbin/sendmail -t -i -f [email protected]'

追記:このマニュアルページ, -rflag は flag の古い形式です-f。そのため、 を使用することを好みます-f

3番目に関してあなたのコメント:

ログを見ると、バウンドしていることがわかります。[メールアドレス]存在しません。これを追加して問題は解決しましたが、Postfixに追加できる設定はありますか?[メールアドレス]作成する必要はありませんか?

このエラーメッセージ

550-検証に失敗しました。550-そのようなユーザーはここにいません" 550 送信者の検証に失敗しました

postfixによってスローされませんでした。メールは、mail.**z*.net実行中の実際のメールサーバーによって拒否されました。輸出入なぜそのような動作をするのか、Exim管理者に問い合わせる必要があります。

答え2

にはmain.cfというパラメータがありますmydestination。そこからドメイン名フォームを削除すると、そのドメインへのメールはローカルに配信されなくなります。

前に:

mydestination = $myhostname, $mydomain

後:

mydestination = $myhostname

$myhostname内部メール(cron、apt、エラーメッセージなど)についてはこのリストに残しておく必要があります。

関連情報