Search Tools Links Login

Send email through Google gmail


This code uses CDO to send an e-mail using your Google gmail account

Original Author: MaxMouseDLL

API Declarations

You must add a reference to Microsoft CDO For Windows 2000 library.

Code

Public Function SendMail(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@googlemail.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 = "someone@somewhere.com"
lobj_cdomsg.From = "username@googlemail.com"
lobj_cdomsg.Subject = "subject"
lobj_cdomsg.TextBody = "body"
'lobj_cdomsg.AddAttachment ("filepath")
lobj_cdomsg.Send
Set lobj_cdomsg = Nothing
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 172 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.