BackEnd/C#

C# asp 메일 보내기 관련 자료

Sky_Developer 2024. 7. 15. 12:56

C# asp 에서 메일 보내는 기능을 아래 자료 참고하여 만듬.

 

https://asp.net-tutorials.com/misc/sending-mails/#google_vignette

https://www.c-sharpcorner.com/article/send-mail-from-asp-net-website/

 

근데 메일 본문에 iframe 으로 pdf 를 첨부하려니까, https 오류가 생김 (메일을 보낼때는 SSL 통신 허용을 false 로 하고 보냄, 그러나 메일을 받는 쪽은 https를 사용하므로 'An existing connection was forcibly closed by the remote host' 오류가 계속 생김.

 

https://stackoverflow.com/questions/2582036/an-existing-connection-was-forcibly-closed-by-the-remote-host

 

그래서 짱구를 굴려서 iframe으로 pdf 파일 내용을 보여주는 대신 이미지로 변환하여 메일 내용에 첨부시키는 방법으로 바꿈

 

그럼 pdf 파일을 이미지 파일로 어떻게 바꾸냐는 아래 내용을 참고했다

 

https://www.dotnetfunda.com/articles/show/3453/convert-pdf-to-png-using-ghostscriptnet

https://www.c-sharpcorner.com/blogs/convert-pdf-file-into-image-filepngjpgjpeg-using-ghostscript