I am new to sendmail, installed the s-nail package on RHEL 8 VM hosted on AWS. I configured the sendmail.mc file but still unable to get mail.
Command used,
echo "First mail" | mail -v -s "Important mail" [email protected]
It shows an error like below, it looks like mail is accepted for delivery but connection got timed out.
Mar 31 10:35:47 ip-172-31-8-189 sendmail[15076]: 42VAZlCI015076: [email protected], ctladdr=ec2-user (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30130, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (42VAZlxs015077 Message accepted for delivery)
Mar 31 10:36:47 ip-172-31-8-189 sendmail[15079]: 42VAZlxs015077: [email protected], [email protected] (1000/1000), delay=00:01:00, xdelay=00:01:00, mailer=relay, pri=120469, relay=smtp.gmail.com. [142.250.4.108], dsn=4.0.0, stat=Deferred: Connection timed out with smtp.gmail.com.
If this is a new EC2 instance, it might is under the default block on SMTP port 25. This is to avoid misuse of EC2 to send spam emails. Steps to get this opened are explained in the link link .
Along with this, you may also want to make sure that your EC2 instance is having a public IP (EIP) and security-groups/NACL/Routing is all good to support this communication