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

SendEmail() public method

Composes an email message based on input data, and then immediately queues the message for sending.

There are several important points to know about SendEmail:

  • 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.

  • 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.

/// 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 SendEmail ( SendEmailRequest request ) : SendEmailResponse
request SendEmailRequest Container for the necessary parameters to execute the SendEmail service method.
return SendEmailResponse
        public SendEmailResponse SendEmail(SendEmailRequest request)
        {
            var marshaller = new SendEmailRequestMarshaller();
            var unmarshaller = SendEmailResponseUnmarshaller.Instance;

            return Invoke<SendEmailRequest,SendEmailResponse>(request, marshaller, unmarshaller);
        }

Usage Example

Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            if (CheckRequiredFields())
            {
                using (var client = new AmazonSimpleEmailServiceClient(RegionEndpoint.USEast1))
                {
                    var sendRequest = new SendEmailRequest
                                        {
                                            Source = senderAddress,
                                            Destination = new Destination { ToAddresses = new List<string> { receiverAddress } },
                                            Message = new Message
                                            {
                                                Subject = new Content("Sample Mail using SES"),
                                                Body = new Body { Text = new Content("Sample message content.") }
                                            }
                                        };
                    try
                    {
                        Console.WriteLine("Sending email using AWS SES...");
                        var response = client.SendEmail(sendRequest);
                        Console.WriteLine("The email was sent successfully.");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("The email was not sent.");
                        Console.WriteLine("Error message: " + ex.Message);

                    }
                }
            }

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }
All Usage Examples Of Amazon.SimpleEmail.AmazonSimpleEmailServiceClient::SendEmail
AmazonSimpleEmailServiceClient