Code:
Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 587
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xx@xx.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xx"
.Update
End With
htmlmsg = "<style>ul { display: block; list-style-type: disc; margin-top: 1em; margin-bottom: 1 em; margin-left: 0; margin-right: 0; padding-left: 0; }</style>" _& "<p><b>Part Number(s)</b>:<br>xx</p>" _
& "<p>Please follow the attached instructions for your return.</p>" _
& "<p>In order for your claim to be processed, please be sure to:</p>" _
& "<p><ul><li>Print this email and return it with your shipment.</li><b>OR</b><br><li>Include your Dealer Number, Serial Number and Claim Number with your shipment.</li></ul></p>" _
& "<p>***** For <b><u>Canadian</u></b> shipments, write your Dealer Number and Claim Number on the <b><u>OUTSIDE</u></b> of the container.</p>" _
subj = "Test"
With cdomsg.To = "xx@xx.com"
.From = "xx@xx.com"
.Subject = subj
.HTMLBody = htmlmsg
Set fso = New FileSystemObject
Set srcfolder = fso.GetFolder("C:hello")
If srcfolder.Files.Count > 0 Then
For Each fsfile In srcfolder.Files
If InStr(1, fsfile.Name, "Thumbs") = 0 Then Set ibp = .addattachment(fsfile.Path)
Next
Else
GoTo attacherror
End If
Set fso = Nothing
Set srcfolder = Nothing
.Send
End With