외부smtp로 메일보내기

일단 환경에 대해 설명을 하자면
외부smtp로 사용하고 하는 서버는 2000 이구, nMail이 깔려있는 상태구여
메일발송을 하려고 하는 서버는 2003 입니다

nMail환경설정에서 스팸에 대한 처리는 다 해놨구여
smtp포트는 25번을 사용합니다

제가 사용한 소스는 아래와 같구여

'메일보내기
set objMessage = createobject("cdo.message")
set objConfig = createobject("cdo.configuration")

' Setting the SMTP Server
Set Flds = objConfig.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'1일 경우 로컬(SMTP), 2일 경우 외부(SMTP)로 메일전송
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.aaa.com"
Flds.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "계정명@aaa.com"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "계정비번"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30

Flds.update

Set objMessage.Configuration = objConfig
objMessage.To = to_email '보내는 사람 이메일 주소
objMessage.From = "보내는이<"&CompanyEmail&">" '받는 사람 이메일 주소
objMessage.Subject = subject '제목
objMessage.HTMLBody = content
objMessage.HTMLBodyPart.Charset="ks_c_5601-1987"

objMessage.fields.update
objMessage.Send

'Response.write "발송 완료!!!!"

set objMessage = nothing
set objConfig = nothing


//----- 성공소스


< %
Option Explicit

Response.Expires = -1
Response.AddHeader "Pragma", "no_cache"
Response.AddHeader "cache-control", "no_cache"
% >
< !--#include virtual="/inc/f_common.asp"-- >
< !--#include virtual="/inc/f_mssql.asp"-- >
< %
ConnectDB()

Dim iMsg
Dim iConf
Dim Flds

Set iConf = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")
Set Flds = iConf.Fields

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.0.0.1" '메일서버 지정
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 '포트
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "webmaster@ngio.co.kr"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "12345"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

.Update
End With

With iMsg
Set .Configuration = iConf
.To = "김홍완"
.From = "엔지오"
.Subject = "메입입니다."
.HTMLBody = "메일내용메일내용메일내용메일내용메일내용메일내용"

'.fields.update
.Send
End With

Set iConf = nothing
Set iMsg = nothing
Set Flds = Nothing

Response.write "발송 완료!!!!"

CloseDB()
% >
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/12/28 16:19 2007/12/28 16:19
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2880

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/2880

« Previous : 1 : ... 3540 : 3541 : 3542 : 3543 : 3544 : 3545 : 3546 : 3547 : 3548 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/04   »
  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        
Statistics Graph

Site Stats

Total hits:
183784
Today:
212
Yesterday:
394