Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS / SES Email sending... What's been your experience?

Anyone using AWS SES for bulk email sending?

We have a company mailing list, and i am using a multi-threaded application (.NET SDK) to send emails concurrently, to get the emails out to our list as quickly as possible.

We have been able to send aproximately 8 emails per second... seems pretty low, especially considering an SES inposed limit of 90/second... We are nowhere near that.

Can anyone tell me the maximum number of emails they have managed to send per second, using SES?

Trying to set a reasonable benchmark.

Thanks!

like image 295
Rebecca Avatar asked Dec 21 '22 00:12

Rebecca


2 Answers

Update

You are currently using the AWS SDK for .NET for sending via SES, which facilitates the original API internally still. AWS meanwhile introduced SMTP Support for the Amazon Simple Email Service (SES), which supposedly makes it even easier for you to send transactional or bulk email:

You no longer need to write any code to gain the efficiency and deliverability benefits of SES. Instead, you use the SES tab of the AWS Management Console to create an SMTP user and a set of credentials, and then you use those credentials to configure the email client of your choice:

A simplistic C# example (i.e. without throttling etc.) is provided in Sending Email From Application Programs:

public static void SendWithSMTP(string username, string password, string host, 
    int port)
{
    using (var client = new System.Net.Mail.SmtpClient(host, port))
    {
        client.Credentials = new System.Net.NetworkCredential(username, password);
        client.EnableSsl = true;
        client.Send("[email protected]", "[email protected]", "This is a test subject.", 
            "This is a test email message body.");
    }
}

To take this even further you might want to add your own MTA into the mix, see Integrating with Your Existing Email Server:

If you currently administer your own email server, you can use the Amazon SES SMTP endpoint to send all of your outgoing email to Amazon SES. There is no need to modify your existing email clients and applications; the changeover to Amazon SES will be transparent to them.

This would relieve your application from handling the SES throttling at all and provide respective wiggle room eventually, however, it obviously requires the MTA administrator to manage this in turn by tuning its sending/relay queues accordingly - this may or may not be knowledge floating around in your organization already, but should provide a more robust SES experience in comparison to handling this per application.


Initial Answer

You might be aware of that already, but since there is likely no definite answer regarding your question, I'd like to highlight the dynamic Amazon SES approach to this again (which is basically independent from any specific AWS SDK in use):

1) You'll need to Request Production Access to Amazon SES before even thinking about bulk mailings:

To help protect our customers from fraud and abuse and to help you establish your trustworthiness to ISPs and email recipients, we do not immediately grant unlimited Amazon SES usage to new users. New users are initially placed in the Amazon SES sandbox. [...] the following restrictions are in effect:

  • Emails can be sent only to and from verified email addresses.
  • You can send a maximum of 200 messages per 24-hour period.
  • You can send a maximum of one message per second.

2) Once granted, your sending limits will be gradually increased based on a number of factors as explained and illustrated in How Amazon SES Sets Sending Limits - particular noteworthy are:

If you have recently been granted production access to Amazon SES, you can initially send up to 10,000 emails per 24-hour period. After a few days, if you continue to send high-quality email, your quota will quickly be raised into the tens of thousands. [emphasis mine]

Furthermore, initially you should be able to send at a maximum rate of 1 email per second. Your maximum sending rate should increase to 10/s in 3 day, 50/s in 10 days and 90/s in 2 weeks, as per the table they provide.

The aggressive quota adjustment pattern in use initially is apparently reduced a bit later on:

Subsequent quota increases occur more gradually; you will need to continue increasing your sending volume. If your volume stays close to your quota without exceeding it. Amazon SES will detect this usage pattern and automatically increase your quota. [emphasis mine]

We had good success with obeying the latter specifically, i.e. as long as we stayed significantly below our sending limits, these limits didn't change at all, but started to do so as soon as we approached them indeed.

Obviously you should supervise this process to ensure you are operating within the current limits and produce low or no bounces etc. - this is addressed in Monitoring Your Sending Limits as well as Monitoring Usage Statistics accordingly:

We strongly encourage you to monitor your usage of Amazon SES to ensure that you operate within your sending limits. You also need to be aware of any bounces or complaints that occur, so that you can determine and resolve the root causes. As you successfully send more email, you should notice that Amazon SES is gradually adjusting your sending limits so that you can send still more email, and at a faster per-second rate. [emphasis mine]

Good luck!

like image 118
Steffen Opel Avatar answered Jan 01 '23 16:01

Steffen Opel


Here is an example I'm using to do bulk email with AWS Simple Email Service

public SendEmailResult SendEmail(ArrayList toemail, string subject, string bodystring, Enums.EmailTypes emailtype)
    {
        var awsConfig = new AmazonSimpleEmailServiceConfig
                           {
                               UseSecureStringForAwsSecretKey = true
                           };
        var awsClient = new AmazonSimpleEmailServiceClient(RoleEnvironment.GetConfigurationSettingValue("AwsAccessKeyId"),
                                                           RoleEnvironment.GetConfigurationSettingValue("AwsSecretKey"),
                                                           awsConfig);

        //EXAMPLE
        var to = new ArrayList
                           {
                               "[email protected]",
                               "[email protected]",
                               "[email protected]"
                           };

        var dest = new Destination();

        dest.WithToAddresses((string[]) to.ToArray(typeof (string)));

        var body = new Body
                        {
                            Html = new Content(bodystring)
                        };

        string fromemail=string.Empty;

        switch (emailtype)
        {
            case Enums.EmailTypes.Notification:
                fromemail = "[email protected]";
                break;
            case Enums.EmailTypes.Support:
                fromemail = "[email protected]";
                break;
        }

        var title = new Content(subject);
        var message = new Message(title, body);
        var ser = new SendEmailRequest(fromemail, dest, message);
        SendEmailResponse seResponse = awsClient.SendEmail(ser);

        return seResponse.SendEmailResult;
    }
like image 27
Filix Mogilevsky Avatar answered Jan 01 '23 14:01

Filix Mogilevsky