-5

Amazon SES を使用して E メールを送信しています。Amazon SES を使用して C# で添付ファイル付きの E メールを送信する方法は?

コード:

            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; 
4

3 に答える 3

2

Amazon SES について特別なことはありません。smtp サーバーを指定して送信するだけです。

public static void SendWithSMTP(string name, string pass, string host, int port)
{
    using (var client = new System.Net.Mail.SmtpClient(host, port))
    {
        client.Credentials = new System.Net.NetworkCredential(name, pass);
        client.EnableSsl = true;
        MailMessage mail = new MailMessage("from@ex.com","to@ex.com",head, body);
        mail.Attachments.Add(new Attachment("specify your attachment path"));
        client.Send(mail);
    }
}
于 2012-03-18T04:08:19.520 に答える
-2

ファイルの URL を送信して、ユーザーにファイルのダウンロードを要求できます。

于 2012-10-27T11:36:10.877 に答える