2017-11-16 16 views
0

으로 전송합니다. 제출할 때 Amazon SES Provider에게 메일을 보내주기를 원했습니다. 어떻게 이것을 할 수 있으며 메일을 보낼 수있는 .NET Core 2.0 라이브러리가 있습니까?asp.net 코어 2.0에서 메일을 Amazon SES

BTW : 프런트 엔드에서 각도를 사용하고 있고 백엔드에서는 WebAPI를 사용하고 있습니다.

답변

0

AWSSDK가 .net Core 2.0을 완벽하게 지원하므로 매우 쉽게 구현할 수 있습니다.

설치 AWSSDK.SimpleEmail. 그런 다음

:

public async Task<bool> SendEmail(string from, string to, string subject, string html){ 
    // might want to provide credentials 
    using(var ses = new AmazonSimpleEmailServiceClient(RegionEndpoint.USEast1)) 

     { 
    var sendResult = await ses.SendEmailAsync(new SendEmailRequest 
      { 
        Source = from, 
        Destination = new Destination(to) { CcAddresses = "if you need them", BccAddresses = "or these" }, 
        Message = new Message 
        { 
         Subject = new Content(subject), 
         Body = new Body 
         { 
          Html = new Content(html) 
         } 
        } 
       }); 
     return sendResult.HttpStatusCode == HttpStatusCode.OK; 
     } 
}