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. When calling this operation, you may specify the message headers as well as the content. The SendRawEmail operation is particularly useful for sending multipart MIME emails (such as those that contain both a plain-text and an HTML version).

In order to send email using the SendRawEmail 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.

Additionally, keep the following considerations in mind when using the SendRawEmail operation:

Note:

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

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

Syntax

C#
public virtual SendRawEmailResponse SendRawEmail(
         SendRawEmailRequest request
)
Parameters
request
Type: Amazon.SimpleEmail.Model.SendRawEmailRequest

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

Return Value
The response from the SendRawEmail 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 an email with an attachment:

SendRawEmail


var response = client.SendRawEmail(new SendRawEmailRequest 
{
    Destinations = new List {
                    
    },
    FromArn = "",
    RawMessage = new RawMessage { Data = new MemoryStream(From: sender@example.com\nTo: recipient@example.com\nSubject: Test email (contains an attachment)\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary="NextPart"\n\n--NextPart\nContent-Type: text/plain\n\nThis is the message body.\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; filename="attachment.txt"\n\nThis is the text in the attachment.\n\n--NextPart--) },
    ReturnPathArn = "",
    Source = "",
    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