Menu
Amazon Simple Email Service
Developer Guide

Send an Email Through Amazon SES Using the AWS SDK for .NET

The following procedure shows you how to use Visual Studio and AWS Toolkit for Visual Studio to create an AWS SDK project and modify the C# code to send an email through Amazon SES. These procedures use the latest version of Microsoft Visual Studio (Visual Studio 2017), but the process of creating a new project based on a template is similar across Visual Studio releases.

Important

In this getting started tutorial, you send an email to yourself so that you can check to see if you received it. For further experimentation or load testing, use the Amazon SES mailbox simulator. Emails that you send to the mailbox simulator do not count toward your sending quota or your bounce and complaint rates. For more information, see Testing Amazon SES Email Sending.

Prerequisites

Before you begin, perform the following tasks:

  • Verify your email address with Amazon SES—Before you can send an email with Amazon SES, you must verify that you own the sender's email address. If your account is still in the Amazon SES sandbox, you must also verify the recipient email address. The easiest way to verify email addresses is by using the Amazon SES console. For more information, see Verification Procedures.

  • Get your AWS credentials—You need an AWS access key ID and AWS secret access key to access Amazon SES using an SDK. You can find your credentials by using the Security Credentials page of the AWS Management Console. For more information about credentials, see Using Credentials With Amazon SES.

  • Install Visual Studio—Visual Studio is available at https://www.visualstudio.com/.

  • Install the AWS Toolkit for Visual Studio—Instructions for adding the AWS Toolkit for Visual Studio are available at http://docs.aws.amazon.com/AWSToolkitVS/latest/UserGuide/.

    Note

    As of May 2017, the AWS Toolkit for Visual Studio is not compatible with Visual Studio 2017. If you are using Visual Studio 2017, you can download a preview version of the AWS Toolkit for Visual Studio 2017.

  • Install the AWS SDK for .NET—The AWS SDK for .NET is available from https://aws.amazon.com/sdk-for-net/

  • Create a shared credentials file—For the sample code in this section to function properly, you must create a shared credentials file. For more information, see Create a Shared Credentials File.

Procedure

The following procedure shows how to send an email through Amazon SES using the AWS SDK for .NET.

To send an email using the AWS SDK for .NET

  1. Create an Amazon SES sample project by performing the following steps:

    1. Start Visual Studio.

    2. On the File menu, choose New, Project.

    3. On the New Project window, in the panel on the left, expand Installed, expand Visual C#, and then expand AWS Samples.

    4. Under AWS Samples, choose App Services.

    5. In the panel on the right, choose AWS SES Sample.

    6. On the .NET Framework menu at the top of the window, choose .NET Framework 4.6.1.

    7. In the Name field, type AmazonSESSample, and then choose OK.

  2. On the AWS Access Credentials window, choose the account profile and Region you want to use for this example, and then choose OK.

  3. In Solution Explorer, double-click Program.cs.

  4. In Program.cs, change the value of senderAddress to a verified email address. Enclose the email address in quotes.

  5. In Program.cs, change the value of receiverAddress to a verified email address. Enclose the email address in quotes.

  6. Save Program.cs.

  7. Build and run the application by completing the following steps:

    1. On the Build menu, choose Build Solution.

    2. On the Debug menu, choose Start Debugging. A console window appears.

  8. Review the output of the console. If the email was successfully sent, the console displays "The email was sent successfully." Otherwise, it displays an error message.

  9. If the email was successfully sent, sign in to the email client of the recipient address. You will find the message that you sent.

On this page: