Amazon's SES service can be used from .NET applications to send mail. You will first need to download the AWS SDK and load the dll into your app's bin directory.
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.
Amazon.SimpleEmail.AmazonSimpleEmailServiceClient client = new Amazon.SimpleEmail.AmazonSimpleEmailServiceClient("aws_public_key_here", "aws_private_key_here");
SendEmailRequest mailObj = new SendEmailRequest();
Destination destinationObj = new Destination(listColl);
mailObj.Source = "from@youremail.com";
////The from email address
mailObj.ReturnPath = "bounce@youremail.com";
////The email address for bounces
mailObj.Destination = destinationObj;
////Create Message
Amazon.SimpleEmail.Model.Content emailSubjectObj = new Amazon.SimpleEmail.Model.Content("This is the Subject");
Amazon.SimpleEmail.Model.Content emailBodyContentObj = new Amazon.SimpleEmail.Model.Content("This is the Body<br /><em>In Html</em>");
Amazon.SimpleEmail.Model.Body emailBodyObj = new Amazon.SimpleEmail.Model.Body();
emailBodyObj.Html = emailBodyContentObj;
Message emailMessageObj = new Message(emailSubjectObj, emailBodyObj);
mailObj.Message = emailMessageObj;
dynamic response = client.SendEmail(mailObj);
blog comments powered by Disqus