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
 
Container for the parameters to the SendRawEmail operation. Sends an email message, with header and content specified by the client. The 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:

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.SimpleEmail.AmazonSimpleEmailServiceRequest
      Amazon.SimpleEmail.Model.SendRawEmailRequest

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

Syntax

C#
public class SendRawEmailRequest : AmazonSimpleEmailServiceRequest
         IRequestEvents

The SendRawEmailRequest type exposes the following members

Constructors

NameDescription
Public Method SendRawEmailRequest() Empty constructor used to set properties independently even when a simple constructor is available
Public Method SendRawEmailRequest(RawMessage) Instantiates SendRawEmailRequest with the parameterized properties

Properties

NameTypeDescription
Public Property Destinations System.Collections.Generic.List<System.String> Gets and sets the property Destinations.

A list of destinations for the message, consisting of To:, CC:, and BCC: addresses.

Public Property FromArn System.String Gets and sets the property FromArn.

This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to specify a particular "From" address in the header of the raw email.

Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message of the email. If you use both the FromArn parameter and the corresponding X-header, Amazon SES uses the value of the FromArn parameter.

For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
Public Property RawMessage Amazon.SimpleEmail.Model.RawMessage Gets and sets the property RawMessage.

The raw text of the message. The client is responsible for ensuring the following:

  • Message must contain a header and a body, separated by a blank line.
  • All required header fields must be present.
  • Each part of a multipart MIME message must be formatted properly.
  • MIME content types must be among those supported by Amazon SES. For more information, go to the Amazon SES Developer Guide.
  • Content must be base64-encoded, if MIME requires it.

Public Property ReturnPathArn System.String Gets and sets the property ReturnPathArn.

This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter.

For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the ReturnPath to be feedback@example.com.

Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw message of the email. If you use both the ReturnPathArn parameter and the corresponding X-header, Amazon SES uses the value of the ReturnPathArn parameter.

For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
Public Property Source System.String Gets and sets the property Source.

The identity's email address. If you do not provide a value for this parameter, you must specify a "From" address in the raw text of the message. (You can also specify both.)

By default, the string must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. For more information, see RFC 2047.

If you specify the Source parameter and have feedback forwarding enabled, then bounces and complaints will be sent to this email address. This takes precedence over any Return-Path header that you might include in the raw text of the message.
Public Property SourceArn System.String Gets and sets the property SourceArn.

This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter.

For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to send from user@example.com, then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the Source to be user@example.com.

Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw message of the email. If you use both the SourceArn parameter and the corresponding X-header, Amazon SES uses the value of the SourceArn parameter.

For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.

Examples

This example shows how to send a raw email.

Send raw email example

// 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);
      

Version Information

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

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8