Amazon SES SMTP Connection Timeout

I am trying to set up email notification for my application using Sendmail along with SES on CentOS 6.5. According to the AWS document , I configured sendmail with SES,

Mylogue says:

sendmail[29711]: s2QFCjnu027924: to=< abc@edf.com >, 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 letters are added to mailq

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

In addition, I cannot execute telnet for the smtp address,

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

But nmap shows that smtp (25) port 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 also tried smtp email-smtp.eu-west-1.amazonaws.com with the EU region, getting the same result.

There are no selinux and iptables rules and security group rules in EC2.

Any help would be greatly appreciated!

+7
amazon-web-services smtp sendmail amazon-ses
source share
4 answers
  • When you send test mail as sudo /usr/sbin/sendmail -f from@example.com to@example.com , the mail is sent to the sender running on your instance.
  • when sendmail tried to deliver mail to SMART_HOST , which is email-smtp.us-east-1.amazonaws.com , it could not connect to email-smtp.us-east-1.amazonaws.com , and therefore the message was placed in deferred queue for retrying later.

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

+3
source share

I also had problems with a timeout. I had no vpc subnet routing since thiyagu114 said this was his problem and none of the hints helped.

This is found in Amazon info:

The Important Elastic Computing Cloud (EC2) throttles email 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 delete email addresses to remove the throttle.

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

+13
source share

We thank Clement for your help.

I get it. This is a vpc subnet routing with the instance.

Now it works like a charm :-)

+1
source share

If you use AWS SES as a relay, you must have this configuration:

Edit main.cf:

 ... relayhost = email-smtp.${aws_region}.amazonaws.com:587 smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_use_tls = yes smtp_tls_security_level = encrypt smtp_tls_note_starttls_offer = yes ... 

Edit / etc / postfix / sasl_passwd

 email-smtp.${aws_region}.amazonaws.com:587 SMTP_USERNAME:SMTP_PASSWORD 

Edit / etc / postfix / transport

 * smtp:email-smtp.${aws_region}.amazonaws.com:587 

Please note that you need to indicate the port in all places, even in transport.

execute postmap

 postmap /etc/postfix/sasl_passwd /etc/postfix/transport 

restart postfix

 service postfix restart 

And it will work. You can find the rest of the configuration at http://docs.aws.amazon.com/ses/latest/DeveloperGuide/postfix.html

0
source share

All Articles