'motobit'에 해당되는 글 1건

  1. 2007/10/08 Window Server 에서 IIS를 이용해 메일 발송

사용자 삽입 이미지


아래 소스는 간단하게 만들어본 소스이며 내용을 더 추가하여 고급기능을 활용할 수 있따.
우선 1번과 2번이 있는데 2003에서 1번은 기본적으로 작동하지 않는다.


'----------------------------------------------------
' 1번) IIS SMTP service, CDONTS.NewMail
'----------------------------------------------------
Const CdoBodyFormatHTML = 0
Const CdoBodyFormatText = 1
Const CdoMailFormatMime = 0
Const CdoMailFormatText = 1

'Send Mail
Dim objSendMail

Set objSendMail = CreateObject("CDONTS.NewMail")

With objSendMail 
 .From = "frommail"
 .To = "tomail"
 .Subject = "title"
 .MailFormat = cdoMailFormatMIME
 .BodyFormat = cdoBodyFormatHTML 
 .Body = "content"
 .Importance = CdoHigh
 .Send
End With

Set objSendMail = nothing


'----------------------------------------------------
' 2번) IIS SMTP service, CDO.Message
'----------------------------------------------------
Const cdoOutlookExvbsss = 2
Const cdoIIS = 1

Dim iMsg

Set iMsg = CreateObject("CDO.Message")

With iMsg 
 .Configuration.Load cdoIIS

 .To = "tomail"
 .From = "frommail"
 .Subject = "title"
 '.HTMLBody = "content"
 .TextBody = "content"
 '.BodyPart.Charset="ks_c_5601-1987"
 '.HTMLBodyPart.Charset="ks_c_5601-1987"

 '파일을 첨부하려면 아래 주석을 제거
 'Dim iBP
 'Set iBP = .AddAttachment(App.Path & "\file1.txt")

 .Send
End With

Set iMsg = Nothing 

위 내용보다 더 자세한 내용은 아래 주소에 가보면 잘 설명해놓았다.
뭐 위에 소스랑 약간 옵션이 다른것도 있긴 하지만 맘에 드는걸로 ㅋㅋ

http://www.motobit.com/tips/detpg_send-email-from-asp/

위 컴퍼넌트 문제라든가..뭐 어떤 이유로 사용할 수 없을 때에는...
개인적으로 imoxion 이라는 곳의 컴퍼넌트를 사용하기도 한다.
업로드 컴퍼넌트와 SMTP 컴퍼넌트는 가입만하면 무료로 다운받아서 사용할 수 있어서 문제도 없다.ㅋ

SMTP : http://www.imoxion.co.kr/solution/solution_smtp_overview.jsp
UpDown : http://www.imoxion.co.kr/solution/solution_updown_overview.jsp
뭐 광고는 아니니...^^;;;

2007/10/08 18:22 2007/10/08 18:22