본문 바로가기
IIS

[ IIS ] window 2003 -> 2008 이전 시 smtp 사용 asp 코드 변경 사항

by 정윤재 2015. 11. 3.

1. 기존 smtp 를 사용한 asp 코딩 (windows 2003)

 

<%

Dim objMail

 

                     Set objMail = Server.CreateObject("CDO.Message")

 

 

                     objMail.To = "받을 메일 주소"

 

                     objMail.From = "보내는 메일 주소" 

                     objMail.Subject = "test"

                     objMail.HTMLBody = "content"

                     objMail.HTMLBodyPart.Charset = "utf-8"

                     objMail.BodyPart.Charset = "utf-8"

                     objMail.Send

 

                     Set objMail = Nothing

%>

2. 2008 R2 에서 변경 되는 MS 권장 코딩

 

<%

Set objConfig = Server.CreateObject("CDO.Configuration")

 

With objConfig.Fields

  .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1

  .item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"

  .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"

  .item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30

  .update

End With

 

Set objMessage = Server.CreateObject("CDO.Message")

 

With objMessage

Set .Configuration = objConfig

  .To = "받을 메일 주소"

  .From = "보내는 메일 주소"

  .Subject = "test"

  .HTMLBody = "test"

  .Send

End With

%>

 


댓글