AWS Messaging & Targeting Blog

Using Microsoft SQL Server 2008 R2 with Amazon SES

This post will help you configure Microsoft SQL Server 2008 R2 to send email through Amazon SES. The instructions apply if you are running SQL Server in Amazon EC2 or hosted elsewhere. This post assumes you are running on Microsoft Windows Server 2008 R2 and SQL Server Management Studio is installed. If you need installation instructions, please refer to the Microsoft SQL Server documentation. The instructions may vary slightly if SQL Server Database Mail profiles or accounts are already set up.

Using Microsoft SQL Server Management Studio

Open Microsoft SQL Server Management Studio and expand the Management node. Right-click Database Mail and select Configure Database Mail in the context menu.

Microsoft SQL Server Object Explorer

This will launch the Database Mail Configuration Wizard. On the Select Configuration Task wizard page, select Set up Database Mail by performing the following tasks and click Next.

Microsoft SQL Server Select Configuration Wizard

If prompted, enable the Database Mail feature.

On the New Profile wizard page, set Profile name to Amazon SES SMTP.

Microsoft SQL Server New Profile Wizard

Now, add a new SMTP account to this profile by clicking the Add… button on the same screen.

  1. Set Account Name to Amazon SES.
  2. Set Outgoing SMTP Email to a verified email address associated with your Amazon SES account.
  3. Set Outgoing SMTP Reply Email to a verified email address associated with your Amazon SES account. This can be the same as the Outgoing SMTP Email.
  4. Set Server Name to email-smtp.us-east-1.amazonaws.com.
  5. Set Server Port to 587.
  6. Set This server requires a secure connection SSL to checked.
  7. Select Basic Authentication and enter your Amazon SES SMTP username and password. The SMTP credentials are different from your AWS keys.
  8. Click OK to add this account and associate it with the Amazon SES SMTP profile.

Microsoft SQL Server New Account Wizard

Click Next to get to the Manage Profile Security wizard page,

  1. Select the Public check box to make Amazon SES SMTP a public profile.
  2. Select Yes for the Default Profile.

Microsoft SQL Server Profile Security

Click Next to get to the System Parameters page. Set Logging Level to Verbose and click Next.

Microsoft SQL Server System Parameters

Verify the actions that the wizard will take and click Finish to apply your changes. After the wizard is done and reports success, click Close.

Microsoft SQL Server Configuration Succeeded

To test your configuration, right click Management » Database Mail » Send Test E-Mail… Enter a recipient address and click Send Test E-Mail.

Microsoft SQL Server Send Test Email

To verify the email was sent, right click Management » Database Mail » View Database Mail Log. Look for a log entry with Mail successfully sent as the message. This indicates that the email from SQL Server was accepted by Amazon SES for delivery.

Microsoft SQL Server Log View

Final Thoughts

We hope that you now have the configuration to use SQL Server 2008 R2 with Amazon SES. If you have comments or feedback about this service, please post them in the Amazon SES forums. We actively monitor the forum and frequently engage with customers. Happy sending with Amazon SES!