2010年7月23日 星期五

CDO SSL sendmail

原出處
參考網址

Friday, July 2, 2010Send mail from your gmail account using VB6 CDO throught SMTP
The following is the function to send email from vb6 application using CDO object.


Public Function SendMail(toMail As String, subject As String, msgBody As String)
Dim lobj_cdomsg As CDO.Message
Set lobj_cdomsg = New CDO.Message
lobj_cdomsg.Configuration.Fields(cdoSMTPServer) = "smtp.gmail.com"
lobj_cdomsg.Configuration.Fields(cdoSMTPServerPort) = 465
lobj_cdomsg.Configuration.Fields(cdoSMTPUseSSL) = True
lobj_cdomsg.Configuration.Fields(cdoSMTPAuthenticate) = 1
lobj_cdomsg.Configuration.Fields(cdoSendUsername) = "username@gmail.com"
lobj_cdomsg.Configuration.Fields(cdoSendPassword) = "password"
lobj_cdomsg.Configuration.Fields(cdoSMTPConnectionTimeout) = 30
lobj_cdomsg.Configuration.Fields(cdoSendUsingMethod) = 2
lobj_cdomsg.Configuration.Fields.Update
lobj_cdomsg.To = toMail
lobj_cdomsg.From = "username@gmail.com"
lobj_cdomsg.subject = subject
lobj_cdomsg.HTMLBody = msgBody
lobj_cdomsg.Send
Set lobj_cdomsg = Nothing
End Function

沒有留言:

張貼留言