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.
SendRawEmail
action is useful for sending multipart MIME emails. The raw text of the message must
comply with Internet email standards; otherwise, the message cannot be sent.
There are several important points to know about SendRawEmail
:
SendRawEmail
enables you to specify the cross-account
identity for the email's "Source," "From," and "Return-Path" parameters in one of
two ways: you can pass optional parameters SourceArn
, FromArn
,
and/or ReturnPathArn
to the API, or you can include the following X-headers
in the header of your raw email: X-SES-SOURCE-ARN
X-SES-FROM-ARN
X-SES-RETURN-PATH-ARN
SourceIdentityArn
and do not specify either the
FromIdentityArn
or ReturnPathIdentityArn
. (The same note
applies to the corresponding X-headers.) If you only specify the SourceIdentityArn
,
Amazon SES will simply set the "From" address and the "Return Path" address to the
identity specified in SourceIdentityArn
. For more information about sending
authorization, see the Amazon
SES Developer Guide.Namespace: Amazon.SimpleEmail
Assembly: AWSSDK.dll
Version: (assembly version)
public abstract SendRawEmailResponse SendRawEmail( SendRawEmailRequest request )
Container for the necessary parameters to execute the SendRawEmail service method.
Exception | Condition |
---|---|
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. |
This example shows how to send a raw email.
// using System.IO; var sesClient = new AmazonSimpleEmailServiceClient(); var stream = new MemoryStream( Encoding.UTF8.GetBytes("From: johndoe@example.com\n" + "To: janedoe@example.com\n" + "Subject: You're invited to the meeting\n" + "Content-Type: text/plain\n\n" + "Please join us Monday at 7:00 PM.") ); var raw = new RawMessage { Data = stream }; var to = new List<string>() { "janedoe@example.com" }; var from = "johndoe@example.com"; var request = new SendRawEmailRequest { Destinations = to, RawMessage = raw, Source = from }; sesClient.SendRawEmail(request);
.NET Framework:
Supported in: 4.5, 4.0, 3.5