mail works, but sendmail doesn't! (Postfix)

I installed postfix on a server and when I send an email with the sendmail command it doesn't get delivered, but when I send with the mail command it does get delivered. What's worse, postfix logs claim it got delivered when using:

This is what the logs show for 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

Obviously it looks right. But no mail ever gets delivered. But this one: echo "test email 2" | mail [email protected] works great! The mail gets sent!

So I don't understand why in the world them mail command works, but not sendmail. Any idea?


Solution 1:

Ok, let's test it direct:

$ 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.

This works, as the message can be seen in https://www.mailinator.com/v4/public/inboxes.jsp?to=sendmail

Your log shows that the message with id 38418406Ehas been sent as well, and that the remote server accepted this mail.

So just try it again, it will work.