メールは動作しますが、sendmail は動作しません。(Postfix)

メールは動作しますが、sendmail は動作しません。(Postfix)

サーバーに postfix をインストールしましたが、sendmailコマンドを使用してメールを送信しても配信されませんが、mailコマンドを使用して送信すると配信されます。さらに悪いことに、postfix のログには、次の使用時に配信されたと記録されています。

ログにはこう記されているecho "test email" | sendmail [email protected]

Sep  4 14:33:03 howtocode1 postfix/pickup[271977]: 38418406E2: uid=0 from=<root>
Sep  4 14:33:03 howtocode1 postfix/cleanup[272164]: 38418406E2: message-id=<[email protected]>
Sep  4 14:33:03 howtocode1 postfix/qmgr[231761]: 38418406E2: from=<[email protected]>, size=295, nrcpt=1 (queue active)
Sep  4 14:33:03 howtocode1 postfix/smtp[272166]: 38418406E2: to=<[email protected]>, relay=mail2.mailinator.com[45.33.83.75]:25, delay=0.06, delays=0.03/0.01/0.01/0.01, dsn=2.0.0, status=sent (250 Ok)
Sep  4 14:33:03 howtocode1 postfix/qmgr[231761]: 38418406E2: removed

明らかに正しいように見えます。しかし、メールは配信されません。しかし、これはうまく機能します。メールが送信されます。echo "test email 2" | mail [email protected]

それで、なぜ them コマンドが機能するのにmail、 が機能しないのか理解できませんsendmail。何か考えはありますか?

答え1

では、直接テストしてみましょう:

$ host -t mx mailinator.com
mailinator.com mail is handled by 1 mail.mailinator.com.
mailinator.com mail is handled by 1 mail2.mailinator.com.
➜  ~ telnet mail.mailinator.com 25
Trying 23.239.11.30...
Connected to mail.mailinator.com.
Escape character is '^]'.
220 mail.mailinator.com ESMTP Postfix
EHLO LutzWillek
250-mail.mailinator.com
250-8BITMIME
250-STARTTLS
250 Ok
MAIL FROM:<[email protected]>
250 Ok
RCPT TO:<[email protected]>
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Test from command line

Hello. This is a test message.
.
250 Ok
Connection closed by foreign host.

これは機能し、メッセージは次のようになります。https://www.mailinator.com/v4/public/inboxes.jsp?to=sendmail

ログには、ID 付きのメッセージ38418406Eも送信され、リモート サーバーがこのメールを受け入れたことが示されています。

もう一度試してみて、それが動作します

答え2

さて、これは今までで最も奇妙なことです。これは機能しません:

echo "Subject: 1hello people" | sendmail [email protected]

しかし、これは機能します:

echo "Subject: hello people
>this is the body" | sendmail [email protected]

何らかの理由で、本文がなく、件名だけの場合は機能しません。送信されたと表示されますが、何らかの理由で受信されないか何かです。Mailinator 以外の場所に送信しようとしましたが、同じ問題が発生しました。

関連情報