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: email@example.com Subject: Put a subject here From: firstname.lastname@example.org 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:<email@example.com> >>> DATA 250 2.1.5 <firstname.lastname@example.org>... Recipient ok 354 Enter mail, end with "." on a line by itself >>> . 250 2.0.0 s0FLLsxw009758 Message accepted for delivery email@example.com... 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 ----- <firstname.lastname@example.org> (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.