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
 
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:

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

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
Type: Amazon.SimpleEmail.Model.SendRawEmailResponse
The response from the SendRawEmail 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 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