In support of this forum post
https://eileenslounge.com/viewtopic.php?f=27&t=38916
This is the example coding used throughout the next posts
Part 1
Log in and enable 2 – Step Verification https://excelfox.com/forum/showthrea...ll=1#post19038
https://excelfox.com/forum/showthrea...age3#post19038
Part 2 Generate Apps Password https://excelfox.com/forum/showthrea...ll=1#post19039
https://excelfox.com/forum/showthrea...age3#post19039
Part 3 Using a gmail "Apps password" in a CDO send mail coding https://excelfox.com/forum/showthrea...ll=1#post19040
https://excelfox.com/forum/showthrea...age3#post19040
Code:Option Explicit Sub SendUsinggmail() Dim ws As Worksheet: Set ws = ThisWorkbook.Worksheets.Item(1) Rem EMail send 'For info see: http://www.excelfox.com/forum/showthread.php/2233-Urgent-support-needed-Multiple-emails-multiple-Excel-workbooks-at-once#post10519 'Working at my end With my With End With Created LCDCW Library, (LCD 1.0 Library ) (Linking Configuration Data_Cods Wollups) With CreateObject("CDO.Message") ' -Linking Cods Wollups-------- Dim LCD_CW As String: Let LCD_CW = "http://schemas.microsoft.com/cdo/configuration/" .Configuration(LCD_CW & "smtpusessl") = True ' .Configuration(LCD_CW & "smtpauthenticate") = 1 ' ' ' Sever info .Configuration(LCD_CW & "smtpserver") = "smtp.gmail.com" ' The mechanism to use to send messages. .Configuration(LCD_CW & "sendusing") = 2 .Configuration(LCD_CW & "smtpserverport") = 25 ' .Configuration(LCD_CW & "sendusername") = "mail2taste@gmail.com" ' .Configuration(LCD_CW & "sendpassword") = "mvxyzxjfgxabcbwo" ' - This is the so called "App Pasword" '_- https://eileenslounge.com/viewtopic.php?p=300957#p300957 ' "FallyOverStkPlop.!*" ' "qkl4diPlopsyPoo.!*" ' .Configuration(LCD_CW & "sendusername") = "YourEMailAddress" ' .Configuration(LCD_CW & "sendpassword") = "YourEMailPassword" ' Optional - How long to try .Configuration(LCD_CW & "smtpconnectiontimeout") = 30 ' ' Intraction protocol is Set/ Updated .Configuration.Fields.Update ' 'End With ' ---------------------- my Created LCDCW Library 'With ' --- ' Data to be sent------ my Created LCDCW Library Dim strHTML As String: Let strHTML = "" & ws.Range("B2").Value & "
How are you Today?
" .To = "doc.aelstein@gmail.com" ' .CC = "doc.aelstein@t-online.de" '.CC = "doc.aelstein@gmail.com" '.CC = "excelvbaexp@gmail.com" '.BCC = "" .from = """SendingFrom gmail""" .Subject = ws.Range("A2").Value .htmlbody = strHTML '.AddAttachment ThisWorkbook.Path & "AnyFile.xyz" .Send ' Do it End With ' CreateObject("CDO.Message") -----my Created LCDCW Library End Sub
That coding when run, will send some simple text from range A2:B2
https://i.postimg.cc/tTxWWhK0/Coding...-via-gmail.jpg
Coding send simple text via gmail.JPG
![]()





Reply With Quote
Bookmarks