Amazon.SimpleEmail.AmazonSimpleEmailServiceClient.SendRawEmail C# (CSharp) Method

SendRawEmail() public method

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:

  • You can only send email from verified email addresses and domains; otherwise, you will get an "Email address not verified" error. If your account is still in the Amazon SES sandbox, you must also verify every recipient email address except for the recipients provided by the Amazon SES mailbox simulator. For more information, go to the Amazon SES Developer Guide.

  • The total size of the message cannot exceed 10 MB. This includes any attachments that are part of the message.

  • Amazon SES has a limit on the total number of recipients per message. The combined number of To:, CC: and BCC: email addresses cannot exceed 50. If you need to send an email message to a larger audience, you can divide your recipient list into groups of 50 or fewer, and then call Amazon SES repeatedly to send the message to each group.

  • The To:, CC:, and BCC: headers in the raw message can contain a group list. Note that each recipient in a group list counts towards the 50-recipient limit.

  • Amazon SES overrides any Message-ID and Date headers you provide.

  • For every message that you send, the total number of recipients (To:, CC: and BCC:) is counted against your sending quota - the maximum number of emails you can send in a 24-hour period. For information about your sending quota, go to the Amazon SES Developer Guide.

  • If you are using sending authorization to send on behalf of another user, 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

    Do not include these X-headers in the DKIM signature, because they are removed by Amazon SES before sending the email.

    For the most common sending authorization use case, we recommend that you specify the 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.

/// Indicates that the configuration set does not exist. /// /// 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. /// /// Indicates that the action failed, and the message could not be sent. Check the error /// stack for more information about what caused the error. ///
public SendRawEmail ( SendRawEmailRequest request ) : SendRawEmailResponse
request SendRawEmailRequest Container for the necessary parameters to execute the SendRawEmail service method.
return SendRawEmailResponse
        public SendRawEmailResponse SendRawEmail(SendRawEmailRequest request)
        {
            var marshaller = new SendRawEmailRequestMarshaller();
            var unmarshaller = SendRawEmailResponseUnmarshaller.Instance;

            return Invoke<SendRawEmailRequest,SendRawEmailResponse>(request, marshaller, unmarshaller);
        }

Usage Example

Exemplo n.º 1
0
    public static void SESSendRawEmail()
    {
      #region SESSendRawEmail
      // using System.IO;

      var sesClient = new AmazonSimpleEmailServiceClient();

      var stream = new MemoryStream(
        Encoding.UTF8.GetBytes("From: [email protected]\n" +
          "To: [email protected]\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>() { "*****@*****.**" };
      var from = "*****@*****.**";

      var request = new SendRawEmailRequest
      {
        Destinations = to,
        RawMessage = raw,
        Source = from
      };

      sesClient.SendRawEmail(request);
      #endregion
    }
All Usage Examples Of Amazon.SimpleEmail.AmazonSimpleEmailServiceClient::SendRawEmail
AmazonSimpleEmailServiceClient