AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 3.5
 
Composes an email message based on input data, and then immediately queues the message for sending.

There are several important points to know about SendEmail:

Namespace: Amazon.SimpleEmail
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public virtual SendEmailResponse SendEmail(
         SendEmailRequest request
)

Parameters

request
Type: Amazon.SimpleEmail.Model.SendEmailRequest

Container for the necessary parameters to execute the SendEmail service method.

Return Value
Type: Amazon.SimpleEmail.Model.SendEmailResponse
The response from the SendEmail service method, as returned by SimpleEmailService.

Exceptions

ExceptionCondition
MessageRejectedException Indicates that the action failed, and the message could not be sent. Check the error stack for more information about what caused the error.

Examples

This example shows how to send an email.

Send email example

var sesClient = new AmazonSimpleEmailServiceClient();           
      
var dest = new Destination
{
  ToAddresses = new List<string>() { "janedoe@example.com" },
  CcAddresses = new List<string>() { "richarddoe@example.com" }
};

var from = "johndoe@example.com";
var subject = new Content("You're invited to the meeting");
var body = new Body(new Content("Please join us Monday at 7:00 PM."));
var msg = new Message(subject, body);

var request = new SendEmailRequest
{
  Destination = dest,
  Message = msg, 
  Source = from
};

sesClient.SendEmail(request);
      

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5