AWS SDK Version 3 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.

Composes an email message and immediately queues it for sending. In order to send email using the SendEmail operation, your message must meet the following requirements:

For every message that you send, the total number of recipients (including each recipient in the To:, CC: and BCC: fields) is counted against the maximum number of emails you can send in a 24-hour period (your sending quota). For more information about sending quotas in Amazon SES, see Managing Your Amazon SES Sending Limits in the Amazon SES Developer Guide.

Note:

For PCL and Unity this operation is only available in asynchronous form. Please refer to SendEmailAsync.

Namespace: Amazon.SimpleEmail
Assembly: AWSSDK.SimpleEmail.dll
Version: 3.x.y.z

Syntax

C#
public abstract SendEmailResponse SendEmail(
         SendEmailRequest request
)
Parameters
request
Type: Amazon.SimpleEmail.Model.SendEmailRequest

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

Return Value
The response from the SendEmail service method, as returned by SimpleEmailService.

Exceptions

ExceptionCondition
ConfigurationSetDoesNotExistException Indicates that the configuration set does not exist.
MailFromDomainNotVerifiedException Indicates that the message could not be sent because Amazon SES could not read the MX record required to use the specified MAIL FROM domain. For information about editing the custom MAIL FROM domain settings for an identity, see the Amazon SES Developer Guide.
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

The following example sends a formatted email:

SendEmail


var response = client.SendEmail(new SendEmailRequest 
{
    Destination = new Destination {
        BccAddresses = new List {
                        
        },
        CcAddresses = new List {
            "recipient3@example.com"
        },
        ToAddresses = new List {
            "recipient1@example.com",
            "recipient2@example.com"
        }
    },
    Message = new Message {
        Body = new Body {
            Html = new Content {
                Charset = "UTF-8",
                Data = "This message body contains HTML formatting. It can, for example, contain links like this one: Amazon SES Developer Guide."
            },
            Text = new Content {
                Charset = "UTF-8",
                Data = "This is the message body in text format."
            }
        },
        Subject = new Content {
            Charset = "UTF-8",
            Data = "Test email"
        }
    },
    ReplyToAddresses = new List {
                    
    },
    ReturnPath = "",
    ReturnPathArn = "",
    Source = "sender@example.com",
    SourceArn = ""
});

string messageId = response.MessageId;

            

Version Information

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

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

Unity:
Supported Versions: 4.6 and above
Supported Platforms: Android, iOS, Standalone

See Also