When sending a mail logged in as ec2-user
to an unknown user:
echo "Subject: test" | /usr/lib/sendmail -v abc
the From:<>
is blank when redirected to ec2-user's alias which is causing the external server to reject the mail. Even setting -f "ec2-user@internal"
doesn't fix it.
Inside my /etc/aliases
I have
root: webmaster@external
ec2-user: webmaster@external
The verbose output displays the following:
abc... Connecting to [127.0.0.1] via relay...
220 internal ESMTP Sendmail 8.14.4/8.14.4; Thu, 24 Mar 2016 16:42:37 GMT
>>> EHLO internal
250-internal Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<ec2-user@internal> SIZE=14
250 2.1.0 <ec2-user@internal>... Sender ok
>>> RCPT To:<abc@internal>
>>> DATA
550 5.1.1 <abc@internal>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
ec2-user... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1038
250 2.1.0 <>... Sender ok
>>> RCPT To:<ec2-user@internal>
>>> DATA
250 2.1.5 <ec2-user@internal>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 u2OGgbZL022963 Message accepted for delivery
ec2-user... Sent (u2OGgbZL022963 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 internal closing connection
When I send a mail to a known user, such as to the ec2-user
or root
, the mail is received.
How can I configure sendmail
to set the From
address when relaying in this way?
OK - its actually to do with the bounce policy
Also on WIKI
https://en.wikipedia.org/wiki/Bounce_message