반응형
public sub SendSmtpMail( byval sender , byval receiver , byval subj_ , byval body_ )
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = iConf.Fields
With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod) = 2 ' cdoSendUsingPort
.Item(cdoSMTPServer) = "SMTP서버 주소
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
'.Item(cdoSMTPAuthenticate) = cdoBasic
'.Item(cdoSendUserName) = "사용자아이디(필수사항아님 일부exchange에서 보안걸경우만)"
'.Item(cdoSendPassword) = "사용자비번(필수사항아님 일부exchange에서 보안걸경우만)"
'.Item(cdoURLProxyServer) = "server:80"
'.Item(cdoURLProxyBypass) = "<local>"
.Item(cdoURLGetLatestVersion) = True
.Update
End With
With iMsg
Set .Configuration = iConf
.To = receiver
.From = sender
.Subject = subj_
.HTMLBody = body_
'.AddAttachment body_
.Send
End With
end sub
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = iConf.Fields
With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod) = 2 ' cdoSendUsingPort
.Item(cdoSMTPServer) = "SMTP서버 주소
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
'.Item(cdoSMTPAuthenticate) = cdoBasic
'.Item(cdoSendUserName) = "사용자아이디(필수사항아님 일부exchange에서 보안걸경우만)"
'.Item(cdoSendPassword) = "사용자비번(필수사항아님 일부exchange에서 보안걸경우만)"
'.Item(cdoURLProxyServer) = "server:80"
'.Item(cdoURLProxyBypass) = "<local>"
.Item(cdoURLGetLatestVersion) = True
.Update
End With
With iMsg
Set .Configuration = iConf
.To = receiver
.From = sender
.Subject = subj_
.HTMLBody = body_
'.AddAttachment body_
.Send
End With
end sub
반응형