Container for the parameters to the SendEmail operation. 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.

Inheritance: AmazonSimpleEmailServiceRequest
Example #1
0
        public void Send(string name, string replyTo, string messageBody)
        {
            var destination = new Destination()
            {
                ToAddresses = new List<string>() { TO }
            };

            var subject = new Content(SUBJECT);

            var body = new Body()
            {
                Html = new Content(string.Format(BODY, name, messageBody))
            };

            var message = new Message(subject, body);

            var request = new SendEmailRequest(FROM, destination, message);

            request.ReplyToAddresses = new List<string> { replyTo };

            var region = Amazon.RegionEndpoint.USEast1;

            using (var client = new AmazonSimpleEmailServiceClient(region))
            {
                try
                {
                    client.SendEmail(request);
                }
                catch(Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Example #2
0
    public static void SESSendEmail()
    {
      #region SESSendEmail
      var sesClient = new AmazonSimpleEmailServiceClient();           
      
      var dest = new Destination
      {
        ToAddresses = new List<string>() { "*****@*****.**" },
        CcAddresses = new List<string>() { "*****@*****.**" }
      };

      var from = "*****@*****.**";
      var subject = new Content("You're invited to the meeting");
      var body = new Body(new Content("Please join us Monday at 7:00 PM."));
      var msg = new Message(subject, body);

      var request = new SendEmailRequest
      {
        Destination = dest,
        Message = msg, 
        Source = from
      };

      sesClient.SendEmail(request);
      #endregion
    }
Example #3
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();
        }
Example #4
0
        public void SendEmails(AmazonSimpleEmailServiceClient aClient)
        {
            IEnumerable<EmailJob> myEmailsToSendOut = theEmailRepo.GetEmailJobsToBeSent();
            if (myEmailsToSendOut.Count<EmailJob>() != 0) {
                ConsoleMessageWithDate("Have to send emails: " + myEmailsToSendOut.Count<EmailJob>());
                foreach (EmailJob myEmailJob in myEmailsToSendOut) {
                    SendEmailRequest myRequest = new SendEmailRequest();

                    List<string> mySendTo = new List<string>();
                    mySendTo.Add(myEmailJob.ToEmail);

                    Content mySubject = new Content(myEmailJob.Subject);
                    Body myBody = new Body();
                    myBody.Html = new Content(myEmailJob.Body);

                    myRequest.Destination = new Destination(mySendTo);
                    myRequest.Message = new Message(mySubject, myBody);
                    myRequest.Source = myEmailJob.FromEmail;

                    //Change flag with the send in between so we can track if shit happened
                    theEmailRepo.MarkEmailPresentToTrue(myEmailJob.Id);
                    aClient.SendEmail(myRequest);
                    theEmailRepo.MarkEmailPostsentToTrue(myEmailJob.Id);

                    ConsoleMessageWithDate("A " + myEmailJob.EmailDescription + " has been sent to " + myEmailJob.ToEmail + " from " + myEmailJob.FromEmail);
                }
            } else {
                ConsoleMessageWithDate("No emails required to be sent out");
            }
        }
Example #5
0
        public static bool SendEmailWithAmazone(string FROM, string TO, string SUBJECT, string BODY, string AWSAccessKey, string AWSSecrectKey, string NameSender)
        {
            string Name = NameSender;
            Destination destination = new Destination().WithToAddresses(new List<string>() { TO });
            // Create the subject and body of the message.
            Amazon.SimpleEmail.Model.Content subject = new Amazon.SimpleEmail.Model.Content().WithData(SUBJECT);
            Amazon.SimpleEmail.Model.Content textBody = new Amazon.SimpleEmail.Model.Content().WithData(BODY);
            Body body = new Body().WithHtml(textBody);

            // Create a message with the specified subject and body.
            Message message = new Message().WithSubject(subject).WithBody(body);

            string Fr = String.Format("{0}<{1}>", Name, FROM);
            SendEmailRequest request = new SendEmailRequest().WithSource(Fr).WithDestination(destination).WithMessage(message);
            using (AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(AWSAccessKey, AWSSecrectKey))
            {
                // Send the email.
                try
                {
                    client.SendEmail(request);
                    return true;
                }
                catch (Exception)
                {
                    return false;
                }
            }
        }
        public Task<bool> SendEmail(string to, string subject, string htmlBody)
        {
            if (string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(htmlBody) || !to.IsEmail()) return Task.FromResult(false);

            var destination = new Destination { ToAddresses = new List<string> { to } };

            var contentSubject = new Content { Charset = Encoding.UTF8.EncodingName, Data = subject };
            var contentBody = new Content { Charset = Encoding.UTF8.EncodingName, Data = htmlBody };
            var body = new Body { Html = contentBody };

            var message = new Message { Body = body, Subject = contentSubject };

            var request = new SendEmailRequest
            {
                Source = FROM_EMAIL,
                Destination = destination,
                Message = message
            };

            var client = new AmazonSimpleEmailServiceClient();

            try
            {
                client.SendEmail(request);
            }
            catch (Exception ex)
            {
               return Task.FromResult(false);
            }

            return Task.FromResult(true);
        }
Example #7
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            string fromAddress = "*****@*****.**";  // Replace with your "From" address. This address must be verified.
            string recipientAddress = "*****@*****.**"; // Replace with a "To" address. If your account is still in the
            string subject = "Test sending email using AWS SDK with C#";
            string body = "This is the email content!";

            AWSCredentials credentials = new BasicAWSCredentials("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY");

            using (var client = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(credentials, RegionEndpoint.USEast1))
            {
                var request = new SendEmailRequest
                {
                    Source = fromAddress,
                    Destination = new Destination { ToAddresses = new List<string> { recipientAddress } },
                    Message = new Message
                    {
                        Subject = new Amazon.SimpleEmail.Model.Content(subject),
                        Body = new Body { Text = new Amazon.SimpleEmail.Model.Content(body) }
                    }
                };

                try
                {
                    // Send the email.
                    var response = client.SendEmail(request);
                    Response.Write("Email sent!");
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
        }
Example #8
0
        //From E-mail address must be verified through Amazon
        /// <param name="AWSAccessKey">public key associated with our Amazon Account</param>
        /// <param name="AWSSecretKey">private key associated with our Amazon Account</param>
        /// <param name="ToEmail">Who do you want to send the E-mail to, seperate multiple addresses with a comma</param>
        /// <param name="FromEmail">Who is the e-mail from, this must be a verified e-mail address through Amazon</param>
        /// <param name="Subject">Subject of e-mail</param>
        /// <param name="Content">Text for e-mail</param>
        public void SendEmail(string AWSAccessKey, string AWSSecretKey, string ToEmail, string FromEmail, string Subject, string Content)
        {
            Amazon.SimpleEmail.AmazonSimpleEmailServiceClient client = new Amazon.SimpleEmail.AmazonSimpleEmailServiceClient(AWSAccessKey, AWSSecretKey);

            SendEmailRequest em = new SendEmailRequest()
                            .WithDestination(new Destination() { BccAddresses = new List<String>() { ToEmail } })
                            .WithSource(FromEmail)
                            .WithMessage(new Message(new Content(Subject), new Body().WithText(new Content(Content))));
            SendEmailResponse response = client.SendEmail(em);
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
            amConfig.UseSecureStringForAwsSecretKey = false;
            AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient(ConfigurationManager.AppSettings["AWSAccessKey"].ToString(), ConfigurationManager.AppSettings["AWSSecretKey"].ToString(),amConfig);
            ArrayList to = new ArrayList();
            //ADD AS TO 50 emails per one sending method//////////////////////
            //to.Add("*****@*****.**");
            //to.Add("*****@*****.**");
            to.Add("*****@*****.**");
            to.Add("*****@*****.**");
            to.Add("*****@*****.**");
            to.Add("*****@*****.**");
            to.Add("*****@*****.**");
            to.Add("*****@*****.**");

            Destination dest = new Destination();
            dest.WithToAddresses((string[])to.ToArray(typeof(string)));

            //dest.WithToAddresses((string[])to.ToArray(typeof(string)));
            string body = "INSERT HTML BODY HERE";
            string subject = "INSERT EMAIL SUBJECT HERE";
            Body bdy = new Body();
            bdy.Html = new Amazon.SimpleEmail.Model.Content(body);
            Amazon.SimpleEmail.Model.Content title = new Amazon.SimpleEmail.Model.Content(subject);
            Message message = new Message(title, bdy);

               //VerifyEmailAddressRequest veaRequest = new VerifyEmailAddressRequest();
               // veaRequest.EmailAddress = "*****@*****.**";
               // VerifyEmailAddressResponse veaResponse = amzClient.VerifyEmailAddress(veaRequest);

            SendEmailRequest ser = new SendEmailRequest("*****@*****.**", dest, message);

            ser.WithReturnPath("*****@*****.**");
            SendEmailResponse seResponse = amzClient.SendEmail(ser);
            SendEmailResult seResult = seResponse.SendEmailResult;

            //GetSendStatisticsRequest request=new GetSendStatisticsRequest();

            //GetSendStatisticsResponse obj = amzClient.GetSendStatistics(request);

            //List<SendDataPoint> sdata = new List<SendDataPoint>();
            //sdata=obj.GetSendStatisticsResult.SendDataPoints;

            //Int64 sentCount = 0,BounceCount=0,DeleveryAttempts=0;

            //for (int i = 0; i < sdata.Count; i++)
            //{
            //    BounceCount = BounceCount +sdata[i].Bounces;
            //    DeleveryAttempts = DeleveryAttempts + sdata[i].DeliveryAttempts;
            //}
            //sentCount = DeleveryAttempts - BounceCount;
        }
 public void SendEmail(string to, string subject, string bodyText, string bodyHtml)
 {
     using (var client = new AmazonSimpleEmailServiceClient(RegionEndpoint.EUWest1))
     {
         var content = new Content(subject);
         var body = new Body{Html = new Content(bodyHtml), Text = new Content(bodyText)};
         var message = new Message(content, body);
         var destination = new Destination(new List<string> {to});
         var sendEmailRequest = new SendEmailRequest(FromEmail, destination, message);
         client.SendEmail(sendEmailRequest);
     }
 }
Example #11
0
        public IEmailSendResult Send(IEmailMessage message)
        {
            var asmRequest = new ASM.ListVerifiedEmailAddressesRequest();
            var ses        = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(_awsAccessKey, _awsSecretKey, RegionEndpoint.USEast1);

            try
            {
                var awsConfirmResponse = ses.ListVerifiedEmailAddresses();
                var verifiedEmails     = awsConfirmResponse.VerifiedEmailAddresses;
                if (verifiedEmails.Contains(_contactEmail) && verifiedEmails.Contains(_contactFromEmail))
                {
                    var emailRequest = new ASM.SendEmailRequest();
                    var destination  = new ASM.Destination();
                    destination.ToAddresses.Add(_contactEmail);

                    var awsMessage = CreateMessage(message);
                    emailRequest.Destination      = destination;
                    emailRequest.Message          = awsMessage;
                    emailRequest.Source           = _contactFromEmail;
                    emailRequest.ReplyToAddresses = new List <string>()
                    {
                        message.Email
                    };

                    var awsSendResponse = ses.SendEmail(emailRequest);
                    var messageId       = awsSendResponse.MessageId;

                    return(new EmailSendResult {
                        Success = (awsSendResponse.HttpStatusCode == System.Net.HttpStatusCode.OK),
                        MessageId = awsSendResponse.MessageId,
                        Message = string.Empty
                    });
                }
                else
                {
                    return(new EmailSendResult
                    {
                        Success = false,
                        MessageId = string.Empty,
                        Message = string.Format("Unable to verify email address. {0} or {1}", _contactEmail, _contactFromEmail)
                    });
                }
            }
            catch (Exception ex)
            {
                return(new EmailSendResult
                {
                    Success = false,
                    MessageId = string.Empty,
                    Message = ex.Message
                });
            }
        }
        public async Task Send(Indulgence indulgence, string indulgenceFilePath)
        {
            service =
                new AmazonSimpleEmailServiceClient(
                    ConfigurationManager.AppSettings["awsAccessKeyId"],
                    ConfigurationManager.AppSettings["awsAccessSecret"]);

            SendEmailRequest request = new SendEmailRequest();
            request.Destination = BuildDestination();
            request.Message=BuildMessage(indulgence);
            request.Source="*****@*****.**";

            var response = service.SendEmail(request);
        }
Example #13
0
        private void button2_Click(object sender, EventArgs e)
        {
            string AccessKey= System.Configuration.ConfigurationManager.AppSettings["AccessKey"];
            string SecrectKey = System.Configuration.ConfigurationManager.AppSettings["SecrectKey"];
            Amazon.SimpleEmail.AmazonSimpleEmailServiceClient mailClient = new Amazon.SimpleEmail.AmazonSimpleEmailServiceClient(AccessKey,SecrectKey);
            //var obj = mailClient.GetSendQuota();
            SendEmailRequest request = new SendEmailRequest();
            List<string> toaddress = new List<string>();
            toaddress.Add("*****@*****.**");
            Destination des = new Destination(toaddress);
            request.Destination = des;
            request.Source = "*****@*****.**";
            Amazon.SimpleEmail.Model.Message mes = new Amazon.SimpleEmail.Model.Message();
            mes.Body = new Body(new Content( @"Hiện tại, Windows Phone mới hỗ trợ đến màn hình full HD, do đó để tương thích với màn hình 2K, hệ điều hành chắc chắn phải có bản cập nhật mới. Mặt khác, vi xử lý Snapdragon 805 của Qualcomm được biết sẽ phát hành đại trà vào nửa sau năm nay, nên thời điểm xuất hiện Lumia 1820 dùng vi xử lý này tại MWC 2014 vào tháng Hai sẽ là dấu hỏi lớn.

            Microsoft đã từng nói hãng đã chi tới 2,6 tỉ USD để phát triển cho hệ điều hành Windows Phone. Và năm nay, Microsoft đang có kế hoạch lớn dành cho Windows Phone lẫn Nokia. Do đó, chúng ta hãy cứ hy vọng Lumia 1525 và Lumia 1820 sẽ là bom tấn smartphone được kích hoạt trong 2014 này."));
            mes.Subject = new Content("Test send via amazon");

            request.Message = mes;

            SendEmailResponse response = mailClient.SendEmail(request);
            var messageId = response.SendEmailResult.MessageId;
            /*GetIdentityNotificationAttributesRequest notifyRequest = new GetIdentityNotificationAttributesRequest();
            List<string> iden = new List<string>();
            iden.Add("*****@*****.**"); //iden.Add(response.ResponseMetadata.RequestId);
            notifyRequest.Identities = iden;
            var notify = mailClient.GetIdentityNotificationAttributes(notifyRequest);
            //MessageBox.Show(notify.GetIdentityNotificationAttributesResult.NotificationAttributes["Bounces"].BounceTopic);

            var temp = mailClient.GetSendStatistics();
            MessageBox.Show("Total: "+temp.GetSendStatisticsResult.SendDataPoints.Count+"\nDeliveryAttempts: "+temp.GetSendStatisticsResult.SendDataPoints[265].DeliveryAttempts+"\n"
                + "Complaints: " + temp.GetSendStatisticsResult.SendDataPoints[265].Complaints + "\n"
                + "Bounces: " + temp.GetSendStatisticsResult.SendDataPoints[265].Bounces + "\n"
                + "Rejects: " + temp.GetSendStatisticsResult.SendDataPoints[265].Rejects + "\n");
               // MessageBox.Show("Max24HourSend:" + obj.GetSendQuotaResult.Max24HourSend + "\nMaxSendRate:" + obj.GetSendQuotaResult.MaxSendRate + "\nSentLast24Hours:" + obj.GetSendQuotaResult.SentLast24Hours);

            Amazon.SimpleNotificationService.Model.GetEndpointAttributesRequest endpointRequest = new Amazon.SimpleNotificationService.Model.GetEndpointAttributesRequest();
            Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient notifyClient = new Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient();
            //string result = notifyClient.GetEndpointAttributes(notify).GetEndpointAttributesResult.ToXML();
            //MessageBox.Show(result);
            */
            Amazon.SQS.AmazonSQSClient client = new Amazon.SQS.AmazonSQSClient(AccessKey, SecrectKey);
            Amazon.SQS.Model.ReceiveMessageRequest SQSrequest = new Amazon.SQS.Model.ReceiveMessageRequest();
            SQSrequest.MaxNumberOfMessages = 10;
            SQSrequest.QueueUrl = "https://sqs.us-east-1.amazonaws.com/063719400628/bounce-queue";
            AmazonQueues.ProcessQueuedBounce(client.ReceiveMessage(SQSrequest));
        }
Example #14
0
        /// <summary>
        ///     Sends an email with opt out option
        /// </summary>
        /// <param name="fromEmail"></param>
        /// <param name="toEmail"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        public bool SendMail(string fromEmail, string toEmail, string subject, string body)
        {
            if (string.IsNullOrEmpty(toEmail) ||
                string.IsNullOrEmpty(fromEmail) ||
                string.IsNullOrEmpty(subject) ||
                string.IsNullOrEmpty(body)) return false;

            try
            {
                toEmail = toEmail.Trim();
                fromEmail = fromEmail.Trim();

                var amzClient = new AmazonSimpleEmailServiceClient(
                    AmazonCloudConfigs.AmazonAccessKey, AmazonCloudConfigs.AmazonSecretKey, RegionEndpoint.USEast1);
                var dest = new Destination();
                dest.ToAddresses.Add(toEmail);

                body =
                    body +
                    Environment.NewLine +
                    Environment.NewLine +
                    Environment.NewLine +
                    Environment.NewLine +
                    Environment.NewLine +
                    "----------------------------" +
                    Environment.NewLine +
                    "Unsubscribe From Email: " + // TODO: LOCALIZE
                    Environment.NewLine +
                    GeneralConfigs.EmailSettingsURL +
                    Environment.NewLine;

                var bdy = new Body {Text = new Content(body)};
                var title = new Content(subject);
                var message = new Message(title, bdy);
                fromEmail = string.Format("{0} <{1}>", GeneralConfigs.SiteName, fromEmail);
                var ser = new SendEmailRequest(fromEmail, dest, message);

                var response = amzClient.SendEmail(ser);

                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
 /// <summary>
 /// The send mail.
 /// </summary>
 /// <param name="from">
 /// The from.
 /// </param>
 /// <param name="to">
 /// The to.
 /// </param>
 /// <param name="subject">
 /// The subject.
 /// </param>
 /// <param name="body">
 /// The body.
 /// </param>
 public void SendMail(string @from, string to, string subject, string body)
 {
     using (var client = Amazon.AWSClientFactory.CreateAmazonSimpleEmailServiceClient(this.credentials))
     {
         var request = new SendEmailRequest();
         var destination = new Destination(to.Split(';', ',').ToList());
         request.WithDestination(destination);
         request.WithSource(@from);
         var message = new Message();
         message.WithSubject(new Content(subject));
         var html = new Body { Html = new Content(body) };
         message.WithBody(html);
         request.WithMessage(message);
         request.WithReturnPath("*****@*****.**");
         client.SendEmail(request);
     }
 }
Example #16
0
        public void SendMail(string to, string subject, string body)
        {
            //smtp would've been quicker but the SSL that .NET uses isn't the same as AWS
            using(var sesClient  = AWSClientFactory.CreateAmazonSimpleEmailServiceClient() )
            {
                string sesFromEmail = ConfigurationManager.AppSettings[Constants.SES_FROM_EMAIL];

                var sendEmailRequest = new SendEmailRequest()
                    .WithDestination(new Destination().WithToAddresses(to))
                    .WithSource(sesFromEmail) // The sender's email address.
                    .WithReturnPath(sesFromEmail)// The email address to which bounce notifications are to be forwarded.
                    .WithMessage(new Message()
                                 	.WithBody(new Body().WithHtml(new Content(body).WithCharset("UTF-8")))
                                 	.WithSubject(new Content(subject).WithCharset("UTF-8")));

                var response = sesClient.SendEmail(sendEmailRequest);
            }
        }
        public void sendEmailToAuthenticateAUser(Users user)
        {
            try
            {
                System.Collections.Generic.List<string> listColl = new System.Collections.Generic.List<string>();
                ////TODO - Write a simple loop to add the recipents email addresses to the listColl object.
                listColl.Add(user.userName.ToString());

                Amazon.SimpleEmail.AmazonSimpleEmailServiceClient client = new Amazon.SimpleEmail.AmazonSimpleEmailServiceClient("AKIAJUPAMCIGTBC2ODXQ", "s7PkEfwVmhbzWT5PFeN5CV3ZzSPemgaaxnwa32pp");
                SendEmailRequest mailObj = new SendEmailRequest();

                Destination destinationObj = new Destination(listColl);

                mailObj.Source = "*****@*****.**";
                ////The from email address
                mailObj.ReturnPath = "*****@*****.**";
                ////The email address for bounces
                mailObj.Destination = destinationObj;

                string urlLink = "http://ec2-177-71-137-221.sa-east-1.compute.amazonaws.com/smartaudiocityguide/User/authenticateUser/?hash=" + user.hash;
                ////Create Message
                Amazon.SimpleEmail.Model.Content emailSubjectObj = new Amazon.SimpleEmail.Model.Content("Authentication for Smart Audio City Guide");
                Amazon.SimpleEmail.Model.Content emailBodyContentObj = new Amazon.SimpleEmail.Model.Content(@"<htm>
                <head>
                <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
                <title>Smart Audio City Guide</title>
                </head>
                <body>
                <div>
                    <a> Welcome " + user.name + "to Smart Audio City Guide </a><br/><a>Click on the link to authenticate your account: <a href='"+urlLink+"'>"+ urlLink+ "</a></a></div></body>");

                Amazon.SimpleEmail.Model.Body emailBodyObj = new Amazon.SimpleEmail.Model.Body();
                emailBodyObj.Html = emailBodyContentObj;
                Message emailMessageObj = new Message(emailSubjectObj, emailBodyObj);
                mailObj.Message = emailMessageObj;

                dynamic response2 = client.SendEmail(mailObj);
            }
            catch (Exception)
            {

            }
        }
Example #18
0
        public void Enviar()
        {
            var body = new Body().WithText(new Content(_log.ToString()));
            var mess = new Message(
                new Content("Backup " + DateTime.Now.ToString("dd/MM/yyyy hh:mm")),
                body);
            var req = new SendEmailRequest("*****@*****.**",
                                           new Destination().WithToAddresses(_destinos),
                                           mess);

            try
            {
                _client.SendEmail(req);
            }
            catch(Exception ex)
            {
                Console.Out.Write(_log.ToString());
            }
        }
 public Task<string> Send(IEnumerable<string> to, IEnumerable<string> cc, string from, string title, string htmlBody, string textBody)
 {
     AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(_accessKey, _secretKey);
     Destination destination = new Destination();
     destination.ToAddresses = to.ToList();
     Content subject = new Content(title);
     Body bodyContent = new Body()
     {
         Html = htmlBody == null ? null : new Content(htmlBody),
         Text = textBody == null ? null : new Content(textBody)
     };
     Message message = new Message(subject, bodyContent);
     SendEmailRequest request = new SendEmailRequest
     {
         ReplyToAddresses = new List<string>() {@from},
         Destination = destination,
         Message = message
     };
     SendEmailResponse response = client.SendEmail(request);
     return Task.FromResult(response.MessageId);
 }
Example #20
0
        public static void SendEmailRegisterInterest(string emailContentPath, string email)
        {
            var recipientEmail = SetRecipientEmail(email);

            // Send email after adding user to interested people
            var bodyContent = new Content(System.IO.File.ReadAllText(emailContentPath));

            // create email request
            var request = new SendEmailRequest()
                .WithDestination(new Destination(new List<string> { recipientEmail }))
                .WithSource("*****@*****.**")
                .WithReturnPath("*****@*****.**")
                .WithMessage(new Message()
                    .WithSubject(new Content("Thanks for joining the GreenMoney waiting list"))
                    .WithBody(new Body().WithHtml(bodyContent))
                );

            // send it
            var client = new AmazonSimpleEmailServiceClient("AKIAIDP5FFSCJUHHC4QA", "NKAzwbtwwhvKuQZj2t6OXxOhaOEuaBYh3E34Jxbs");
            client.SendEmail(request);
        }
Example #21
0
        public static void SendEmailAdditionalMemberInvitation(string email, string inviterName, string url)
        {
            var bodyContent = "Your household member " + inviterName +
                              " sent you this <a href='" + url + "'>link</a> to join Green Money.";

            var recipientEmail = SetRecipientEmail(email);

            // create email request
            var request = new SendEmailRequest()
                .WithDestination(new Destination(new List<string> { recipientEmail }))
                .WithSource("*****@*****.**")
                .WithReturnPath("*****@*****.**")
                .WithMessage(new Message()
                    .WithSubject(new Content("GreenMoney. Household member invitation"))
                    .WithBody(new Body().WithHtml(new Content(bodyContent)))
                );

            //send it
            var client = new AmazonSimpleEmailServiceClient("AKIAIDP5FFSCJUHHC4QA",
                "NKAzwbtwwhvKuQZj2t6OXxOhaOEuaBYh3E34Jxbs");
            client.SendEmail(request);
        }
Example #22
0
        public static bool SendEmailWithAmazone(string FROM, string TO, string SUBJECT, string BODY, string AWSAccessKey, string AWSSecrectKey, string NameSender)
        {
            log4net.ILog log = log4net.LogManager.GetLogger("ErrorRollingLogFileAppender");
            try
            {
                string Name = NameSender;
                Destination destination = new Destination().WithToAddresses(new List<string>() { TO });
                // Create the subject and body of the message.
                Amazon.SimpleEmail.Model.Content subject = new Amazon.SimpleEmail.Model.Content().WithData(SUBJECT);
                Amazon.SimpleEmail.Model.Content textBody = new Amazon.SimpleEmail.Model.Content().WithData(BODY);
                Body body = new Body().WithHtml(textBody);

                // Create a message with the specified subject and body.
                Message message = new Message().WithSubject(subject).WithBody(body);

                string Fr = String.Format("{0}<{1}>", Name, FROM);
                SendEmailRequest request = new SendEmailRequest().WithSource(Fr).WithDestination(destination).WithMessage(message);

                using (AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(AWSAccessKey, AWSSecrectKey))
                {
                    // Send the email.
                    try
                    {
                        client.SendEmail(request);
                        return true;
                    }
                    catch (Exception e)
                    {
                        log.Error("ProcessSendEmail-callSendBulkMail_BySubGroup" + e);
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.ToString()); log.Error("ProcessSendEmail-callSendBulkMail_BySubGroup" + ex);return false;
            }
        }
        /// <summary>
        ///     <see cref="Send" /> the email message to Amazon's Simple Email Service.
        /// </summary>
        /// <returns>true if it succeeds, false if it fails.</returns>
        internal bool Send()
        {
            _email.MessageId = string.Empty;

            try
            {
                var message = new Message
                {
                    Body =
                        _email.HTML
                            ? new Body().WithHtml(new Content(_email.MessageBody)) : new Body().WithText(new Content(_email.MessageBody)),
                    Subject = new Content(_email.MessageSubject)
                };
                var request = new SendEmailRequest(_email.FromAddress, _email.Destination, message);
                using (var client = new Client(_email.Credentials))
                {
                    _email.MessageId = client.SendFormattedEmail(request);
                }

                return !_email.ErrorExists;
            }
            catch (AmazonSimpleEmailServiceException ex)
            {
                return _email.SetErrorMessage(
                    string.Format(
                        "AWS Simple Email Service Exception\n\nError Type: {0}\n" +
                        "Error Code: {1}\nRequest Id: {2}\nStatus Code: {3}\n\n{4}",
                        ex.ErrorType, ex.ErrorCode, ex.RequestId, ex.StatusCode, ex));
            }
            catch (AmazonClientException ex)
            {
                return _email.SetErrorMessage(ex.ToString());
            }
            catch (Exception ex)
            {
                return _email.SetErrorMessage(ex.ToString());
            }
        }
Example #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
            amConfig.UseSecureStringForAwsSecretKey = false;
            AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient(ConfigurationManager.AppSettings["AWSAccessKey"].ToString(), ConfigurationManager.AppSettings["AWSSecretKey"].ToString(), amConfig);
            ArrayList to = new ArrayList();
            to.Add("*****@*****.**");
            //to.Add("*****@*****.**");
            for (int i = 0; i < to.Count; i++)
            {
                Destination dest = new Destination();
                dest.WithToAddresses(to[i].ToString());
                string body = "Hello this is testing AWS";
                string subject = "Test AWS";
                Body bdy = new Body();
                bdy.Html = new Amazon.SimpleEmail.Model.Content(body);
                Amazon.SimpleEmail.Model.Content title = new Amazon.SimpleEmail.Model.Content(subject);
                Message message = new Message(title, bdy);
                SendEmailRequest ser = new SendEmailRequest("*****@*****.**", dest, message);
                ser.WithReturnPath("*****@*****.**");
                SendEmailResponse seResponse = amzClient.SendEmail(ser);
                SendEmailResult seResult = seResponse.SendEmailResult;

            }

            //GetSendStatisticsRequest request = new GetSendStatisticsRequest();
            //GetSendStatisticsResponse obj = amzClient.GetSendStatistics(request);
            //List<SendDataPoint> sdata = new List<SendDataPoint>();
            //sdata = obj.GetSendStatisticsResult.SendDataPoints;
            //Int64 sentCount = 0, BounceCount = 0, DeleveryAttempts = 0;
            //for (int i = 0; i < sdata.Count; i++)
            //{
            //    BounceCount = BounceCount + sdata[i].Bounces;
            //    DeleveryAttempts = DeleveryAttempts + sdata[i].DeliveryAttempts;
            //}
            //sentCount = DeleveryAttempts - BounceCount;
        }
        public bool SendEmail()
        {
            //INITIALIZE AWS CLIENT//
            AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
            //amConfig.UseSecureStringForAwsSecretKey = false;
            AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient(
              AppSettingHelper.GetAmazonAccessKey(),AppSettingHelper.GetAmazonSecretKey(),//ConfigurationManager.AppSettings["AWSAccessKey"].ToString(),
               RegionEndpoint.USEast1);// ConfigurationManager.AppSettings["AWSSecretKey"].ToString(), amConfig);

            //ArrayList that holds To Emails. It can hold 1 Email to any
            //number of emails in case what to send same message to many users.
            var to = new List<string>();
            to.Add("*****@*****.**");

            //Create Your Bcc Addresses as well as Message Body and Subject
            Destination dest = new Destination();
            dest.BccAddresses.Add("*****@*****.**");
            //string body = Body;
            string subject = "Subject : " + "Demo Mail";
            Body bdy = new Body();
            bdy.Html = new Amazon.SimpleEmail.Model.Content("Test Mail");
            Amazon.SimpleEmail.Model.Content title = new Amazon.SimpleEmail.Model.Content(subject);
            Message message = new Message(title, bdy);

            //Create A Request to send Email to this ArrayList with this body and subject
            try
            {
                SendEmailRequest ser = new SendEmailRequest("*****@*****.**", dest, message);
                SendEmailResponse seResponse = amzClient.SendEmail(ser);
               // SendEmailResult seResult = seResponse.SendEmailResult;
            }
            catch (Exception ex)
            {

            }

            return true;
        }
        /// <summary>
        /// <para>Composes an email message based on input data, and then immediately queues the message for sending. </para> <para><b>IMPORTANT:</b>
        /// You can only send email from verified email addresses and domains. If you have not requested production access to Amazon SES, 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. </para> <para>The total size of the message cannot exceed 10 MB.</para> <para>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. </para> <para>For every message that you send, the total number of recipients (To:, CC: and BCC:) is counted
        /// against your <i>sending quota</i> - the maximum number of emails you can send in a 24-hour period. For information about your sending quota,
        /// go to the <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/manage-sending-limits.html">Amazon SES Developer Guide</a> .
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendEmail service method on
        /// AmazonSimpleEmailService.</param>
        /// 
        /// <returns>The response from the SendEmail service method, as returned by AmazonSimpleEmailService.</returns>
        /// 
        /// <exception cref="T:Amazon.SimpleEmail.Model.MessageRejectedException" />
		public SendEmailResponse SendEmail(SendEmailRequest request)
        {
            var task = SendEmailAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the SendEmail operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendEmail operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<SendEmailResponse> SendEmailAsync(SendEmailRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendEmailRequestMarshaller();
            var unmarshaller = SendEmailResponseUnmarshaller.Instance;

            return InvokeAsync<SendEmailRequest,SendEmailResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Composes an email message based on input data, and then immediately queues the message
        /// for sending.
        /// 
        ///  
        /// <para>
        /// There are several important points to know about <code>SendEmail</code>:
        /// </para>
        ///  <ul> <li> 
        /// <para>
        /// 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 <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-addresses-and-domains.html">Amazon
        /// SES Developer Guide</a>.
        /// </para>
        ///  </li> <li> 
        /// <para>
        /// The total size of the message cannot exceed 10 MB. This includes any attachments that
        /// are part of the message.
        /// </para>
        ///  </li> <li> 
        /// <para>
        /// 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.
        /// </para>
        ///  </li> <li> 
        /// <para>
        /// 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 <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/manage-sending-limits.html">Amazon
        /// SES Developer Guide</a>.
        /// </para>
        ///  </li> </ul>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SendEmail service method.</param>
        /// 
        /// <returns>The response from the SendEmail service method, as returned by SimpleEmailService.</returns>
        /// <exception cref="Amazon.SimpleEmail.Model.ConfigurationSetDoesNotExistException">
        /// Indicates that the configuration set does not exist.
        /// </exception>
        /// <exception cref="Amazon.SimpleEmail.Model.MailFromDomainNotVerifiedException">
        /// 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 <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/mail-from-edit.html">Amazon
        /// SES Developer Guide</a>.
        /// </exception>
        /// <exception cref="Amazon.SimpleEmail.Model.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.
        /// </exception>
        public SendEmailResponse SendEmail(SendEmailRequest request)
        {
            var marshaller = new SendEmailRequestMarshaller();
            var unmarshaller = SendEmailResponseUnmarshaller.Instance;

            return Invoke<SendEmailRequest,SendEmailResponse>(request, marshaller, unmarshaller);
        }
        public void SendEmail(Ec2Key ec2Key, string fromAddress, List<string> toAddresses, string subject, string body)
        {
            AmazonSimpleEmailService ses = CreateAmazonSes(ec2Key);

            var request = new SendEmailRequest
                              {
                                  Destination = new Destination(toAddresses),
                                  ReplyToAddresses = new List<string> { fromAddress },
                                  Message = new Message
                                                {
                                                    Subject = new Content(subject),
                                                    Body = new Body(new Content(body))
                                                },
                                ReturnPath = fromAddress,
                                Source = fromAddress
                              };

            ses.SendEmail(request);
        }
        /// <summary>
        /// <para>Composes an email message based on input data, and then immediately queues the message for sending. </para> <para><b>IMPORTANT:</b>
        /// You can only send email from verified email addresses and domains. If you have not requested production access to Amazon SES, 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. </para> <para>The total size of the message cannot exceed 10 MB.</para> <para>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. </para> <para>For every message that you send, the total number of recipients (To:, CC: and BCC:) is counted
        /// against your <i>sending quota</i> - the maximum number of emails you can send in a 24-hour period. For information about your sending quota,
        /// go to the <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/manage-sending-limits.html">Amazon SES Developer Guide</a> .
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendEmail service method on
        /// AmazonSimpleEmailService.</param>
        /// 
        /// <returns>The response from the SendEmail service method, as returned by AmazonSimpleEmailService.</returns>
        /// 
        /// <exception cref="T:Amazon.SimpleEmail.Model.MessageRejectedException" />
		public SendEmailResponse SendEmail(SendEmailRequest request)
        {
            var task = SendEmailAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
 private Amazon.SimpleEmail.Model.SendEmailResponse CallAWSServiceOperation(IAmazonSimpleEmailService client, Amazon.SimpleEmail.Model.SendEmailRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Email Service (SES)", "SendEmail");
     try
     {
         #if DESKTOP
         return(client.SendEmail(request));
         #elif CORECLR
         return(client.SendEmailAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the SendEmail operation.
        /// <seealso cref="Amazon.SimpleEmail.IAmazonSimpleEmailService.SendEmail"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendEmail operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<SendEmailResponse> SendEmailAsync(SendEmailRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendEmailRequestMarshaller();
            var unmarshaller = SendEmailResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, SendEmailRequest, SendEmailResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SimpleEmail.Model.SendEmailRequest();

            if (cmdletContext.ConfigurationSetName != null)
            {
                request.ConfigurationSetName = cmdletContext.ConfigurationSetName;
            }

            // populate Destination
            var requestDestinationIsNull = true;

            request.Destination = new Amazon.SimpleEmail.Model.Destination();
            List <System.String> requestDestination_destination_BccAddress = null;

            if (cmdletContext.Destination_BccAddress != null)
            {
                requestDestination_destination_BccAddress = cmdletContext.Destination_BccAddress;
            }
            if (requestDestination_destination_BccAddress != null)
            {
                request.Destination.BccAddresses = requestDestination_destination_BccAddress;
                requestDestinationIsNull         = false;
            }
            List <System.String> requestDestination_destination_CcAddress = null;

            if (cmdletContext.Destination_CcAddress != null)
            {
                requestDestination_destination_CcAddress = cmdletContext.Destination_CcAddress;
            }
            if (requestDestination_destination_CcAddress != null)
            {
                request.Destination.CcAddresses = requestDestination_destination_CcAddress;
                requestDestinationIsNull        = false;
            }
            List <System.String> requestDestination_destination_ToAddress = null;

            if (cmdletContext.Destination_ToAddress != null)
            {
                requestDestination_destination_ToAddress = cmdletContext.Destination_ToAddress;
            }
            if (requestDestination_destination_ToAddress != null)
            {
                request.Destination.ToAddresses = requestDestination_destination_ToAddress;
                requestDestinationIsNull        = false;
            }
            // determine if request.Destination should be set to null
            if (requestDestinationIsNull)
            {
                request.Destination = null;
            }

            // populate Message
            var requestMessageIsNull = true;

            request.Message = new Amazon.SimpleEmail.Model.Message();
            Amazon.SimpleEmail.Model.Body requestMessage_message_Body = null;

            // populate Body
            var requestMessage_message_BodyIsNull = true;

            requestMessage_message_Body = new Amazon.SimpleEmail.Model.Body();
            Amazon.SimpleEmail.Model.Content requestMessage_message_Body_message_Body_Html = null;

            // populate Html
            var requestMessage_message_Body_message_Body_HtmlIsNull = true;

            requestMessage_message_Body_message_Body_Html = new Amazon.SimpleEmail.Model.Content();
            System.String requestMessage_message_Body_message_Body_Html_html_Charset = null;
            if (cmdletContext.Html_Charset != null)
            {
                requestMessage_message_Body_message_Body_Html_html_Charset = cmdletContext.Html_Charset;
            }
            if (requestMessage_message_Body_message_Body_Html_html_Charset != null)
            {
                requestMessage_message_Body_message_Body_Html.Charset = requestMessage_message_Body_message_Body_Html_html_Charset;
                requestMessage_message_Body_message_Body_HtmlIsNull   = false;
            }
            System.String requestMessage_message_Body_message_Body_Html_html_Data = null;
            if (cmdletContext.Html_Data != null)
            {
                requestMessage_message_Body_message_Body_Html_html_Data = cmdletContext.Html_Data;
            }
            if (requestMessage_message_Body_message_Body_Html_html_Data != null)
            {
                requestMessage_message_Body_message_Body_Html.Data  = requestMessage_message_Body_message_Body_Html_html_Data;
                requestMessage_message_Body_message_Body_HtmlIsNull = false;
            }
            // determine if requestMessage_message_Body_message_Body_Html should be set to null
            if (requestMessage_message_Body_message_Body_HtmlIsNull)
            {
                requestMessage_message_Body_message_Body_Html = null;
            }
            if (requestMessage_message_Body_message_Body_Html != null)
            {
                requestMessage_message_Body.Html  = requestMessage_message_Body_message_Body_Html;
                requestMessage_message_BodyIsNull = false;
            }
            Amazon.SimpleEmail.Model.Content requestMessage_message_Body_message_Body_Text = null;

            // populate Text
            var requestMessage_message_Body_message_Body_TextIsNull = true;

            requestMessage_message_Body_message_Body_Text = new Amazon.SimpleEmail.Model.Content();
            System.String requestMessage_message_Body_message_Body_Text_text_Charset = null;
            if (cmdletContext.Text_Charset != null)
            {
                requestMessage_message_Body_message_Body_Text_text_Charset = cmdletContext.Text_Charset;
            }
            if (requestMessage_message_Body_message_Body_Text_text_Charset != null)
            {
                requestMessage_message_Body_message_Body_Text.Charset = requestMessage_message_Body_message_Body_Text_text_Charset;
                requestMessage_message_Body_message_Body_TextIsNull   = false;
            }
            System.String requestMessage_message_Body_message_Body_Text_text_Data = null;
            if (cmdletContext.Text_Data != null)
            {
                requestMessage_message_Body_message_Body_Text_text_Data = cmdletContext.Text_Data;
            }
            if (requestMessage_message_Body_message_Body_Text_text_Data != null)
            {
                requestMessage_message_Body_message_Body_Text.Data  = requestMessage_message_Body_message_Body_Text_text_Data;
                requestMessage_message_Body_message_Body_TextIsNull = false;
            }
            // determine if requestMessage_message_Body_message_Body_Text should be set to null
            if (requestMessage_message_Body_message_Body_TextIsNull)
            {
                requestMessage_message_Body_message_Body_Text = null;
            }
            if (requestMessage_message_Body_message_Body_Text != null)
            {
                requestMessage_message_Body.Text  = requestMessage_message_Body_message_Body_Text;
                requestMessage_message_BodyIsNull = false;
            }
            // determine if requestMessage_message_Body should be set to null
            if (requestMessage_message_BodyIsNull)
            {
                requestMessage_message_Body = null;
            }
            if (requestMessage_message_Body != null)
            {
                request.Message.Body = requestMessage_message_Body;
                requestMessageIsNull = false;
            }
            Amazon.SimpleEmail.Model.Content requestMessage_message_Subject = null;

            // populate Subject
            var requestMessage_message_SubjectIsNull = true;

            requestMessage_message_Subject = new Amazon.SimpleEmail.Model.Content();
            System.String requestMessage_message_Subject_subject_Charset = null;
            if (cmdletContext.Subject_Charset != null)
            {
                requestMessage_message_Subject_subject_Charset = cmdletContext.Subject_Charset;
            }
            if (requestMessage_message_Subject_subject_Charset != null)
            {
                requestMessage_message_Subject.Charset = requestMessage_message_Subject_subject_Charset;
                requestMessage_message_SubjectIsNull   = false;
            }
            System.String requestMessage_message_Subject_subject_Data = null;
            if (cmdletContext.Subject_Data != null)
            {
                requestMessage_message_Subject_subject_Data = cmdletContext.Subject_Data;
            }
            if (requestMessage_message_Subject_subject_Data != null)
            {
                requestMessage_message_Subject.Data  = requestMessage_message_Subject_subject_Data;
                requestMessage_message_SubjectIsNull = false;
            }
            // determine if requestMessage_message_Subject should be set to null
            if (requestMessage_message_SubjectIsNull)
            {
                requestMessage_message_Subject = null;
            }
            if (requestMessage_message_Subject != null)
            {
                request.Message.Subject = requestMessage_message_Subject;
                requestMessageIsNull    = false;
            }
            // determine if request.Message should be set to null
            if (requestMessageIsNull)
            {
                request.Message = null;
            }
            if (cmdletContext.ReplyToAddress != null)
            {
                request.ReplyToAddresses = cmdletContext.ReplyToAddress;
            }
            if (cmdletContext.ReturnPath != null)
            {
                request.ReturnPath = cmdletContext.ReturnPath;
            }
            if (cmdletContext.ReturnPathArn != null)
            {
                request.ReturnPathArn = cmdletContext.ReturnPathArn;
            }
            if (cmdletContext.Source != null)
            {
                request.Source = cmdletContext.Source;
            }
            if (cmdletContext.SourceArn != null)
            {
                request.SourceArn = cmdletContext.SourceArn;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }