Hi there
I'm sending bulk emails through my Gmail account. The emails are sending but does not include the signature image at the end.
Can somebody help me with the right code, please?
Thank you!
I'm sending bulk emails through my Gmail account. The emails are sending but does not include the signature image at the end.
Can somebody help me with the right code, please?
Thank you!
Code:
Private Sub CmdEmailReview_Click()
Dim strText As String
Dim HTMLBody As String
Dim i As Long
Dim txt_To As String
Dim txt_Subject As String
Dim txt_Message As String
Dim txt_CC As String
Dim txt_BCC As String
Dim cbo_Importance As Long
Dim cbo_EmailFormat As Long
Dim ContactID
txt_CC = ""
txt_BCC = ""
cbo_Importance = 1
cbo_EmailFormat = 1
strText = "z:\EmailFiles\Review.htm"
Set Attachment = Message.AddRelatedBodyPart(CurrentDBDir() & imageName2, imageName2, cdoRefTypeId)
Attachment.Fields.Item("urn:schemas:mailheader:Content-ID") = "<imageId2>"
If Forms!frmContactEmails!ContactList.ItemsSelected.Count < 1 Then
Exit Sub
End If
Status "Sending Emails..."
For i = 0 To Forms!frmContactEmails!ContactList.ListCount - 1
If Forms!frmContactEmails!ContactList.Selected(i) Then
txt_To = Forms!frmContactEmails!ContactList.Column(2, i)
txt_Subject = "Request for a Review"
ContactID = Forms!frmContactEmails!ContactList.Column(0, i)
'HTMLBody = "<HTML><BODY style=font-family:Arial; style=font-size:18px>" & strBody & "<IMG src=z:\EmailFiles\Logo.png><br>"
HTMLBody = "<font face=Arial><p>" & "Dear " & Forms!frmContactEmails!ContactList.Column(1, i) & ReadTextFile(strText) & "</p>"
txt_Message = HTMLBody & "<IMG src=z:\EmailFiles\Logo.jpg><br>"
If GMail_Email(txt_To, txt_Subject, txt_Message, Nz(txt_CC), Nz(txt_BCC), cbo_Importance, cbo_EmailFormat) Then
DoCmd.RunSQL "INSERT INTO tblCorrespondence (ContactID, CorrDate, Notes, CorrType) " & _
"VALUES (" & ContactID & "," & Format(Now(), "\#dd\-mmm\-yyyy\#") & ",""" & "Request a Review" & """,""" & "Email" & """)"
Else
DoCmd.RunSQL "INSERT INTO tblCorrespondence (ContactID, CorrDate, Notes, CorrType) " & _
"VALUES (" & ContactID & "," & Format(Now(), "\#dd\-mmm\-yyyy\#") & ",""" & "Email not sent" & """,""" & "Email" & """)"
End If
End If
Sleep 1000
Next
Status "Done!!"
Beep
End Sub