我正在使用 Amazon SES 发送电子邮件。如何使用 Amazon SES 在 C# 中发送带附件的电子邮件?
代码:
AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
amConfig.UseSecureStringForAwsSecretKey = false;
AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient("username", "password", amConfig);
ArrayList to = new ArrayList();
to.Add("sharmila@test.com");
Destination dest = new Destination();
dest.WithBccAddresses((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);
SendEmailRequest ser = new SendEmailRequest("websupport@test.com", dest, message);
SendEmailResponse seResponse = amzClient.SendEmail(ser);
SendEmailResult seResult = seResponse.SendEmailResult;