私のLinuxホストからEメールを送信できません

私のLinuxホストからEメールを送信できません

私のLinuxホストからEメールを送信できません。私が試したコマンドは次のとおりです。

echo "This is the message body and contains the message" | sudo mailx -v  [email protected]  -s "This is the subject"

または

mail -s "Test Subject" [email protected] < /home/system/mailbody.txt

出力:

Mail Delivery Status Report will be mailed to <root>.

実行中のプロセスです。

$ ps -ef | grep postfix
postfix   2993 30866  0 19:15 ?        00:00:00 pickup -l -t unix -u
system    4399   594  0 19:28 pts/0    00:00:00 grep --color=auto postfix
root     30866     1  0  2020 ?        00:00:19 /usr/libexec/postfix/master -w
postfix  30868 30866  0  2020 ?        00:00:05 qmgr -l -t unix -u

以下は、ポート25が私のシステムをリッスンしていることを示すTelnetです。

$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 efendibey_live.localdomain ESMTP Postfix

出力は次のとおりですmailq

$ mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
AE3BF1FC5       606 Sun Feb  7 19:15:10  system@efendibey_live.localdomain
            (connect to mx2.zoho.com[136.143.191.44]:25: Connection timed out)
                                         [email protected]

7410B47CA       602 Sun Feb  7 19:18:57  system@efendibey_live.localdomain
(delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[2404:6800:4003:c06::1a]:25: Network is unreachable)
                                         [email protected]

3EC5F1EC2       474 Sun Feb  7 19:13:34  system@efendibey_live.localdomain
            (connect to mx2.zoho.com[136.143.191.44]:25: Connection timed out)
                                         [email protected]

456251FC6       656 Sun Feb  7 19:18:04  system@efendibey_live.localdomain
            (connect to mx2.zoho.com[136.143.191.44]:25: Connection timed out)
                                         [email protected]

1CB9D48FB       652 Sun Feb  7 19:20:04  system@efendibey_live.localdomain
(connect to alt2.gmail-smtp-in.l.google.com[2404:6800:4003:c06::1a]:25: Network is unreachable)
                                         [email protected]

1FE9B450F       652 Sun Feb  7 19:19:45  system@efendibey_live.localdomain
(connect to alt2.gmail-smtp-in.l.google.com[2404:6800:4003:c06::1a]:25: Network is unreachable)
                                         [email protected]

B180025B5       654 Sun Feb  7 19:25:25  root@efendibey_live.localdomain
(delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[2404:6800:4003:c06::1a]:25: Network is unreachable)
                                         [email protected]

修正する:

アウトバウンドポートも開いて接続されています。

$ telnet gmail-smtp-in.l.google.com 25
Trying 108.177.119.26...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP g24si11485107edh.82 - gsmtp

電子メールを送信するコマンドを実行すると、そこで電子メールが表示され、mailQキューから消えますが、受信トレイにはまだメッセージが表示されません。

[system@efendibey_live ~]$ echo "This is the message body and contains the message" | sudo mailx -v  [email protected] -s "This is the subject"
Mail Delivery Status Report will be mailed to <root>.

[system@live ~]$ mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
3723C16BC*      658 Mon Feb  8 13:37:13  root@ebey_live.localdomain
                                         [email protected]

-- 1 Kbytes in 1 Request.

[system@live ~]$ mailq
Mail queue is empty
[system@live ~]$

tail -f /var/log/maillog以下は、単一メール転送コマンドの出力です。

Feb  8 15:29:43 Efendibey_Live postfix/pickup[10591]: E4F5F16A9: uid=0 from=<root>
Feb  8 15:29:43 Efendibey_Live postfix/cleanup[18223]: E4F5F16A9: message-id=<20210208152943.E4F5F16A9@efendibey_live.localdomain>
Feb  8 15:29:43 Efendibey_Live postfix/qmgr[1193]: E4F5F16A9: from=<root@efendibey_live.localdomain>, size=467, nrcpt=1 (queue active)
Feb  8 15:29:45 Efendibey_Live postfix/smtp[18225]: E4F5F16A9: to=<[email protected]>, relay=mx.zoho.com[136.143.191.44]:25, delay=1.2, delays=0.03/0.01/0.67/0.51, dsn=5.7.1, status=bounced (host mx.zoho.com[136.143.191.44] said: 541 5.7.1 Mail rejected due to antispam policy (in reply to RCPT TO command))
Feb  8 15:29:45 Efendibey_Live postfix/cleanup[18223]: 468D216BC: message-id=<20210208152945.468D216BC@efendibey_live.localdomain>
Feb  8 15:29:45 Efendibey_Live postfix/qmgr[1193]: 468D216BC: from=<>, size=2472, nrcpt=1 (queue active)
Feb  8 15:29:45 Efendibey_Live postfix/bounce[18227]: E4F5F16A9: sender non-delivery notification: 468D216BC
Feb  8 15:29:45 Efendibey_Live postfix/qmgr[1193]: E4F5F16A9: removed
Feb  8 15:29:45 Efendibey_Live postfix/local[18228]: 468D216BC: to=<root@efendibey_live.localdomain>, relay=local, delay=0.02, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Feb  8 15:29:45 Efendibey_Live postfix/qmgr[1193]: 468D216BC: removed

そのオプションを試してみましたが、まだメールを受信して​​いません。-f [email protected]mailx

これは私の/etc/hostsアイテムです

# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

127.0.0.1 guest
::1       guest

127.0.0.1 Efendibey_Live
::1       Efendibey_Live

LinuxホストからEメールを受信する方法を提案してもらえますか?

ベストアンサー1

この回答のクレジットは次のとおりです。Linuxの赤ちゃん最近同じ問題が発生したときに使用しました。

メールサーバーで次のコマンドを実行して、ポート25(アウトバウンド)がブロックされていることを確認します。

telnet gmail-smtp-in.l.google.com 25

ブロックされていない場合は、接続が正常に行われたことを示す次のメッセージが表示されます。 (ヒント:quit接続を閉じるにはEnterを押してEnterを押します。)

Trying 74.125.68.26...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP y22si1641751pll.208 - gsmtp

ポート25(アウトバウンド)がブロックされると、次のような内容が表示されます。

Trying 2607:f8b0:400e:c06::1a...
Trying 74.125.195.27...
telnet: Unable to connect to remote host: Connection timed out

この状況では、Postfixは他のSMTPサーバーに電子メールを送信できません。 ISP/ホスティングプロバイダにアウトバウンドポート25を開くように依頼してください。彼らがあなたの要求を拒否した場合は、次のことを行う必要があります。ポート25ブロックをバイパスするようにSMTPリレーを設定するまたはVPSを使用してください。スカラーホスティングこれはポート25をブロックしません。

「遮断を迂回するためにポート25を別のポートに変更できますか?」と質問される方もいらっしゃるでしょう。私の答えはいいえです。ポートの変更は、サーバー側とクライアント側の両方を制御する場合にのみ機能します。 Postfixが電子メールを送信するときにSMTPクライアントとして機能します。受信者のメールサーバーはSMTPサーバーとして機能します。受信SMTPサーバーを制御できません。。 SMTPサーバーはEメールを受信するためにポート25を受信して​​います。彼らはSMTPクライアントがポート25にアクセスすると予想しています。電子メールを受信するために使用できる他のポートはありません。 Postfix が受信 SMTP サーバーのポート 25 に接続されていない場合は、電子メールを送信できません。

おすすめ記事