2012-03-18 5 views
-5

전자 메일을 보내려면 Amazon SES를 사용하고 있습니다. Amazon SES를 사용하여 C#으로 첨부 파일이있는 이메일을 보내는 방법은 무엇입니까?Amazon SES를 사용하여 C#의 첨부 파일로 전자 메일 보내기

코드 : 아마존 SES 특별한

  AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig(); 
      amConfig.UseSecureStringForAwsSecretKey = false; 
      AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient("username", "password", amConfig); 
      ArrayList to = new ArrayList();       
      to.Add("[email protected]"); 

      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("[email protected]", dest, message); 
      SendEmailResponse seResponse = amzClient.SendEmail(ser); 
      SendEmailResult seResult = seResponse.SendEmailResult; 
+1

CES에서 다른 전자 메일을 보내는 것과 같은 방법으로 SES로 전자 메일을 보냅니다. C# 코드, 특정 질문 및 코드에서받을 수있는 특정 오류를 게시해야합니다. – paulsm4

+0

감사합니다. 첨부 파일이있는 이메일을 보내려는 코드 – sharmila

답변

1

아무것도, 당신의 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("[email protected]","[email protected]",head, body); 
     mail.Attachments.Add(new Attachment("specify your attachment path")); 
     client.Send(mail); 
    } 
} 
+0

감사합니다. 첨부 파일없이 전자 메일을 보내도록 코딩했습니다. 첨부 파일이있는 – sharmila

+2

이메일이 필요합니다. 필자의 예에서는 첨부 파일이 있습니다. –

+0

죄송합니다. 나는주의를 기울이지 않았다. 나 해보자. 감사합니다 – sharmila

-2

url 파일을 보내고 사용자에게 파일 다운로드를 요청할 수 있습니다.

관련 문제