관리 메뉴

웹개발자의 기지개

[ASP] 메일발송하기 - 네이버 SMTP 설정하기 포함 본문

ASP

[ASP] 메일발송하기 - 네이버 SMTP 설정하기 포함

웹개발자 워니 2020. 11. 12. 08:40

보통의 경우 메일발송할때 자체 서버에서 메일서버를 셋팅해서 운영하면 스팸처리되어 제대로 수신이 안되는 경우가 허다하게 발생한다.

이러한 경우에 흔히 다음 메일서버나 구글메일서버의 smtp 를 이용하면 깔끔하게 수신처리됨을 알 수 있다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<%
Function MailDelivery(fAdd, tAdd, mCon, mSub)
    Dim SendMail
    Dim SendConf
    Dim SendField
 
    Set SendMail  = Server.CreateObject("CDO.Message")
    Set SendConf  = Server.CreateObject("CDO.Configuration")
    Set SendField = SendConf.Fields
 
    SendField("http://schemas.microsoft.com/cdo/configuration/sendusing"= 2
    SendField("http://schemas.microsoft.com/cdo/configuration/smtpserver"= "smtp.daum.net"
    SendField("http://schemas.microsoft.com/cdo/configuration/smtpserverport"= 465
    SendField("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"= 1
    SendField("http://schemas.microsoft.com/cdo/configuration/smtpusessl"= 1
    SendField("http://schemas.microsoft.com/cdo/configuration/sendusername"= "아이디"
    SendField("http://schemas.microsoft.com/cdo/configuration/sendpassword"= "비번"
    SendField.Update
 
    With SendMail
        Set .Configuration = SendConf
        .From = fAdd
        .To = tAdd
        .Subject = mCon
        .HTMLBody = mSub
        .Send
    End With
    Set SendMail = Nothing
    Set SendField = Nothing
    Set SendConf = Nothing
End Function
 
 
fAdd = "보내는 메일"
tAdd = "받는 메일"
 
mSub = "임시 비밀번호 발급 안내입니다."
mCon = "내용입니다."
 
Call MailDelivery(fAdd, tAdd, mSub, mCon)
%>
cs

 

 

네이버 SMTP 이용

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<%
        toReceive = "받는이메일주소"
 
        mCon = "발급된 임시 비밀번호는 1111 입니다."
 
        mSub = "임시 비밀번호 발급 안내입니다."
 
 
              Set objCMsg = Server.CreateObject("CDO.message")
              Set iConf = Server.CreateObject("CDO.Configuration")
             
 
              strschema = "http://schemas.microsoft.com/cdo/configuration/"
             
              With iConf.Fields
              
                  .item(strschema & "sendusing"= 2     
                  .item(strschema & "smtpserverport"= 465      
                  .item(strschema & "smtpserver"= "smtp.naver.com"     
                  .item(strschema & "smtpusessl"= 1      
                  .item(strschema & "sendusername"= "이메일주소"     
                  .item(strschema & "sendpassword"= "비밀번호0"     
                  .item(strschema & "smtpauthenticate"= 1      
                  .Item(strschema & "smtpconnectiontimeout"= 60
             
              .Update
             
              End With
             
              Set objCMsg.Configuration = iConf
              objCMsg.From = "보내는사람이메일" 
              objCMsg.To =  toReceive 
              objCMsg.subject = mSub   
              objCMSg.BodyPart.Charset="utf-8"         
              objCMsg.HTMLbody = mCon 
              objCMSg.HTMLBodyPart.Charset="utf-8"              
              
              objCMsg.Send 
             
              set objCMsg = nothing
              Set iConf = Nothing    
%>
cs

 

 

 

 

네이버 SMTP 를 이용시 아래와 같이 설정을 하도록 하자.

 

 

Comments