Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub SendGMail()
- ' Object creation
- Set objMessage = CreateObject("CDO.Message")
- Set msgConf = CreateObject("CDO.Configuration")
- ' Server Configuration
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "frantag@gmail.com"
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Heslo123"
- msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
- msgConf.Fields.Update
- ' Email
- objMsg.To = "franta@montix.cz"
- objMsg.From = "montixpacking@gmail.com"
- objMsg.Subject = "Test send with Gmail account"
- objMsg.HTMLBody = "Fili, balení tě postrádá."
- objMsg.Sender = "Packing"
- Set objMsg.Configuration = msgConf
- ' Send
- objMsg.Send
- ' Clear
- Set objMsg = Nothing
- Set msgConf = Nothing
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement