I'm having trouble getting sendmail to send out emails from my AWS EC2 machine.
I'm using the following command to send an email:
sendmail -vt < mail.txt
The mail.txt file has the following content (edited for security):
To: firstname.lastname@example.org Subject: Put a subject here From: email@example.com Message body
When I run sendmail it looks like things are working:
>>> MAIL From:<ec2-user@XXX.us-west-2.compute.internal> SIZE=128 250 2.1.0 <ec2-user@XXX.us-west-2.compute.internal>... Sender ok >>> RCPT To:<firstname.lastname@example.org> >>> DATA 250 2.1.5 <email@example.com>... Recipient ok 354 Enter mail, end with "." on a line by itself >>> . 250 2.0.0 s0FLLsxw009758 Message accepted for delivery firstname.lastname@example.org... Sent (s0FLLsxw009758 Message accepted for delivery)
However I never get the email on my yahoo account. Next I checked /var/log/messages and it said I have new mail in "/var/spool/mail/ec2-user". Here is what I saw in that file:
----- The following addresses had permanent fatal errors ----- <email@example.com> (reason: 553 #5.1.8 Domain of sender address <ec2-user@XXX.us-west-2.compute.internal> does not exist) ----- Transcript of session follows ----- ... while talking to smtp02.yahoo.com.: >>> MAIL From:<ec2-user@XXX.us-west-2.compute.internal> SIZE=669 <<< 553 #5.1.8 Domain of sender address <ec2-user@XXX.us-west-2.compute.internal> does not exist 501 5.6.0 Data format error
Can someone tell me what configuration is needed to make this work? The XXX above is my ip-XXX-YYY-ZZZ-AAA address which corresponds to my EC2 machine.
I did some searching around for solutions but none of those I found have worked for me so far.