메뉴 건너뛰기

Dev tips

ASP cdo.message 메일보내기

taknim 2008.04.01 04:20 조회 수 : 12233 추천:2568

        Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
        Const cdoSendUsingPort = 2
        Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
        Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
        Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
        Const cdoSMTPAccountName = "http://schemas.microsoft.com/cdo/configuration/smtpaccountname"
        Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
        Const cdoBasic = 1
        Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
        Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

        Dim objConfig, objMessage, Fields
        Set objConfig = Server.CreateObject("CDO.Configuration")
        Set objMessage = Server.CreateObject("CDO.Message")

        ' 메일 서버 세팅
        Set Fields = objConfig.Fields

        With Fields
                .Item(cdoSendUsingMethod) = cdoSendUsingPort
                .Item(cdoSMTPServer) = "221.143.21.239"
                .Item(cdoSMTPServerPort) = 25
                .Item(cdoSMTPAuthenticate) = cdoBasic
'                .Item(cdoSendUserName) = "helpdesk@daewanghw.co.kr"
'                .Item(cdoSendPassword) = "*****"
                .Update
        End With

        ' 발송할 내용 세팅
        Set objMessage.Configuration = objConfig
        objMessage.From = "torage@aaa.com"
        objMessage.To = "이름<aaa@aaa.com>"
        objMessage.Subject = "디스크 용량 확인"
        objMessage.HtmlBody = StrHTML
        objMessage.BodyPart.Charset="ks_c_5601-1987"        '/// 한글을 위해선 꼭 넣어 주어야 합니다.
        objMessage.HTMLBodyPart.Charset="ks_c_5601-1987"        '/// 한글을 위해선 꼭 넣어 주어야 합니다.
        objMessage.Send                ' 발송

        Set objMessage = Nothing
        Set objConfig = Nothing