3초기억력

iis 10에서 외부 smtp 네이버 계정으로 메일 보내기 본문

플밍_ASP

iis 10에서 외부 smtp 네이버 계정으로 메일 보내기

잠수콩 2023. 7. 27. 13:37
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

 

 

 

제목 : Classic asp, iis10 에서 네이버 smtp 외부 메일로 파일첨부 메일 보내기 소스

 
 

 

소스 :


<%
mailTitle = "제목입니다."
    mailContent = "내용입니다. html로도 됩니다."

    Set iConf = Server.CreateObject("CDO.Configuration")
    With iConf.Fields
       .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
       .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.naver.com"
       .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
       .item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
       .item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
       .item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "네이버계정아이디"
       .item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "네이버계정비밀번호"
       .item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
       .Update
    End With

Set iMsg = Server.CreateObject("CDO.Message")
    iMsg.Configuration = iConf
    Set iConf = Nothing

    With iMsg
.To = "받는사람이메일"
.From = "보낸사람이메일"
.Subject = mailTitle
.HtmlBody = mailContent 'HtmlBody, TextBody
.AddAttachment Server.MapPath("/절대경로폴더/파일명") '파일첨부 url 형식으로 해도 된다.
.Attachments(1).Fields.Item("urn:schemas:mailheader:content-disposition") = "attachment; filename=파일명" '파일명
.Attachments(1).Fields.Update
.Send
    End With

    Set iMsg = Nothing
%>

 

 

 

내용 :

 

1. 사전 준비

- 네이버메일 접속 : 환경설정 pop/smtp 사용 체크

 

2. 위 소스를 asp 메일 보내는 곳에 삽입

- 파일은 URL도 되고 하드디스크 절대경로도 된다.

-- url 방식 : http://도메인/폴더/파일명.확장자 --> http://naver.com/upload/test.png 

-- 파일첨부 방식 : Server.MapPath("/절대경로폴더/파일명")

 

3. 주의

- ssl 포트 465

- TLS 가 아닌 SSL 로 인증을 하는게 좋다.(안되는 서버가 있다)

 

 

 
 

 

예제 소스 파일 :

ASP_네이버SMTP.zip
0.00MB

 

 출처 :  나

 

 

 



 

Comments