Amazon SES SMTP Connection timed out

20,195

Solution 1

  • When you are sending a test mail as sudo /usr/sbin/sendmail -f [email protected] [email protected], the mail is handed over to the sendmail running on your instance.
  • when sendmail tried to deliver the mail to the SMART_HOST which is email-smtp.us-east-1.amazonaws.com, it wasnt able to connect to email-smtp.us-east-1.amazonaws.com and so the email was placed in the deferred queue for retrying later.

So the problem is that your sendmail instance wasnt able to talk to email-smtp.us-east-1.amazonaws.com.

Solution 2

I was having trouble with the timeout as well. I didn't have any vpc subnet routing as thiyagu114 said was his issue, and none of clement's suggestions helped.

Found this on the Amazon info:

Important Elastic Compute Cloud (EC2) throttles email traffic over port 25 by default. To avoid timeouts when sending email through the SMTP endpoint from EC2, use a different port (587 or 2587) or fill out a Request to Remove Email Sending Limitations to remove the throttle.

So switching from port 25 to 587 fixed the timeout issue for me.

Solution 3

Thank you Clement for your help.

I figured it out the issue. it was vpc subnet routing problem with the instance.

Now it works like a charm :-)

Share:
20,195
Thiyagarajan Varadharaj
Author by

Thiyagarajan Varadharaj

A passionate linux administrator.

Updated on July 09, 2022

Comments

  • Thiyagarajan Varadharaj
    Thiyagarajan Varadharaj almost 2 years

    I have been trying to set up an email notification for my application using Sendmail along with SES on CentOS 6.5. As per AWS document, I have configured sendmail with SES,

    The maillog says,

    sendmail[29711]: s2QFCjnu027924: to=<[email protected]>, delay=00:52:09, xdelay=00:08:00, mailer=relay, pri=210717, relay=email-smtp.us-east-1.amazonaws.com [107.20.142.169], dsn=4.0.0, stat=Deferred: Connection timed out with email-smtp.us-east-1.amazonaws.com

    All mails are being added in mailq

    # sendmail -v -q
    Running /var/spool/mqueue/s2QFueiS001965 (sequence 1 of 21)
    <[email protected]> Connecting to email-smtp.us-east-1.amazonaws.com port 25 via relay.
    ^C
    

    Also, I unable to do telnet to the smtp address,

    # telnet email-smtp.us-east-1.amazonaws.com 25
    Trying 23.21.252.142...
    ^C
    

    But nmap shows port smtp (25) is open and listening,

    # nmap -p 25 localhost
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2014-03-26 17:09 CET
    Nmap scan report for localhost (127.0.0.1)
    Host is up (0.000080s latency).
    PORT   STATE SERVICE
    25/tcp open  smtp
    
    Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
    

    netstat output,

    tcp   0    0 0.0.0.0:25   0.0.0.0:*  LISTEN      29708/sendmail
    

    I have tried with EU region smtp email-smtp.eu-west-1.amazonaws.com as well, getting the same result.

    There is no selinux and iptables running and security group rules are fine with EC2.

    Any help would be highly appreciated !!