PostfixはMydomainから送信できません。 - サードパーティのドメインにのみ送信できます。

PostfixはMydomainから送信できません。 - サードパーティのドメインにのみ送信できます。

だから私はUbuntuサーバーを設定し、postfixを使ってPHP経由でメールを送信したいと思います。

サーバーホスト:example.com

サーバーが電子メールを送信するとき[Eメール保護]、エラーが発生します。別のアドレスに送信する場合([Eメール保護])、良い結果。

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = localhost
inet_protocols = all
mailbox_size_limit = 0
mydestination = example.com, localhost.localdomain, , localhost
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated 
defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

PHP経由でexample.comアドレスに電子メールを送信すると、次のエラーが発生します。

exception 'Zend\Mail\Protocol\Exception\RuntimeException' with message '5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table

PHP経由でAnyOtherDomain.comにメールを送信してもエラーはありません。

example.com の実際のメールはサードパーティのサーバーで処理されます。すべてのSPF / DKIMレコードが所定の位置にあるため、サードパーティドメインに送信される限り、転送は正常に機能します。

明らかに、これは私がまだ把握しようとしている設定です。

編集する:

メールログを詳しく調べてみると、次のことがわかりました。

Apr  6 13:37:57 somename postfix/local[25416]: 3625CE2EB7: to=<[email protected]>, relay=local, delay=0.03, delays=0.02/0.01/0/0.01, dsn=5.1.1, status=undeliverable (unknown user: "support")
Apr  6 13:42:29 xxxxx postfix/smtpd[25501]: connect from localhost[127.0.0.1]
Apr  6 13:42:29 xxxxx postfix/smtpd[25501]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<localhost>
Apr  6 13:42:29 xxxxx postfix/smtpd[25501]: disconnect from localhost[127.0.0.1]

だから私はサーバーが電子メールアドレスの代わりにユーザーにメッセージを送信しようとしていると思います。

ベストアンサー1

これがうまくいかないのは、次のように設定したからです。

MyDomains には example.com が含まれます。

~から手動

mydestinationパラメーターは、他のシステムに渡すのではなく、このシステムからローカルに渡すドメインを指定します。デフォルトは、マシン自体がメールを受信することです。

犯人は次の行です。

mydestination = example.com, localhost.localdomain, , localhost

次に更新してください。

localhost.localdomain, localhost

デフォルトでは、PostFixはexample.comのすべてのメールを送信するのではなく処理しようとします。

おすすめ記事