Amazon SES Stops Working


I set up Amazon SES and it initially worked for a few hours, then all of a sudden stopped. All of the e-mails I’m sending as, and our domain, have been verified. We are no sending bulk e-mails – only a few hundred per day. Whenever I make changes to the web.config it seems to allow it work again for another 2-3 hours. For example, It stopped working so I switched port 587 to 25, and it began working for 2-3 hours, then stopped. Then I switched back to 587 and the same thing happened. Once it stops working it doesn’t ever seem to start again on its own. It is running on two load balanced servers, framework v2.0, IIS 7.5. Here is the code I’m using:


c# code:

Here are the two errors I’ve been receiving:

I tried to get help on the Amazon forums but haven’t had any luck. It seems like something is interfering with the connection but I don’t know what. Any ideas? Thanks.


This sounds like a tricky issue indeed – I’m not 100% positive on this, but you seem to miss disposing the SMTP client, which is mentioned in Sending email is often very slow after changing to VPC instance to cause the very error you are seeing:

When I do not dispose of the SmtpClient, I get the error…

‘Service not available, closing transmission channel. The server
response was: Timeout waiting for data from client.’

This would actually be a good explanation for intermittent problems, i.e. depending on the executed code path this issue could trigger the SMTP connection to Amazon SES to hang, which is obviously remedied by switching to another port, implying the connection being reset – that’s what the SmtpClient.Dispose Method ensures as well:

Sends a QUIT message to the SMTP server, gracefully ends the TCP
connection, and releases all resources used by the current instance of
the SmtpClient class.

Accordingly, an appropriate pattern would be to facilitate a using Statement, as demonstrated in Getting Started with Amazon SES and .NET:

Please note that the sample is using port 25, which I highly recommend to avoid due to the usually implied sending restrictions, see Addendum below for details regarding the respective Amazon EC2 throttling.

Good luck!


Amazon EC2 throttling on port 25

You are probably aware of this (and I actually don’t think it’s an issue here), but Amazon EC2 imposes default sending limits on email sent via port 25 and throttles outbound connections if you attempt to exceed those limits which still applies when using Amazon SES, see Amazon SES SMTP Issues:

You are sending to Amazon SES from an Amazon EC2 instance via port 25
and you cannot reach your Amazon SES sending limits or you are
receiving time outs
— Amazon SES EC2 imposes default sending limits on
email sent via port 25 and throttles outbound connections if you
attempt to exceed those limits. To remove these limits, submit a
Request to Remove Email Sending Limitations. You can also connect to
Amazon SES via port 465 or port 587, neither of which is throttled.

Consequently I’d remove port 25 out of your testing/switching scenario and use ports 465/587 only instead in order to avoid false leads (as quoted you could also request to get this limitation removed though, but it will take a few hours and port 25 seems to be best avoided in the first place) – it’s a bit unfortunate that several official Amazon SES samples are using port 25 without even mentioning this easily triggered issue indeed.

Leave a Reply