VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Send email through Google gmail

by MaxMouseDLL (1 Submission)
Category: Internet/HTML
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

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

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

Rate Send email through Google gmail

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) = "[email protected]"
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 = "[email protected]"
lobj_cdomsg.From = "[email protected]"
lobj_cdomsg.Subject = "subject"
lobj_cdomsg.TextBody = "body"
'lobj_cdomsg.AddAttachment ("filepath")
lobj_cdomsg.Send
Set lobj_cdomsg = Nothing
End Function

Download this snippet    Add to My Saved Code

Send email through Google gmail Comments

No comments have been posted about Send email through Google gmail. Why not be the first to post a comment about Send email through Google gmail.

Post your comment

Subject:
Message:
0/1000 characters