Skip to main content

Posts

Showing posts with the label Amazon

Send Email Attachments with Amazon-SES in C#

These two methods can be used to send emails with Attachment using Amazon-SES in C# Application.
public Boolean SendRawEmail(String from, String to, String cc, String Subject, String text, String html, String replyTo, string attachPath)

    {
        AlternateView plainView = AlternateView.CreateAlternateViewFromString(text, Encoding.UTF8, "text/plain");
        AlternateView htmlView = AlternateView.CreateAlternateViewFromString(html, Encoding.UTF8, "text/html");

        MailMessage mailMessage = new MailMessage();

        mailMessage.From = new MailAddress(from);

        List<String> toAddresses = to.Replace(", ", ",").Split(',').ToList();

        foreach (String toAddress in toAddresses)
        {
            mailMessage.To.Add(new MailAddress(toAddress));
        }

        List<String> ccAddresses = cc.Replace(", ", ",").Split(',').Where(y => y != "").ToList();

        foreach (String ccAddress…