Dear All,
this is my code to send email using outlook. I have a form that displays the addresses for a category and the button captures all of the email and opens up outlook to send email.
I want to the code to work for google mail.
Can anyone advise how I should edit my code to work with google mail?
Thanks!!!
this is my code to send email using outlook. I have a form that displays the addresses for a category and the button captures all of the email and opens up outlook to send email.
I want to the code to work for google mail.
Can anyone advise how I should edit my code to work with google mail?
Thanks!!!
Code:
Private Sub Command5_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim strEmailAddress
Set MyDb = CurrentDb()
Set rsEmail = MyDb.OpenRecordset("Query ASPACEX Contact Officer", dbOpenSnapshot)
Do Until rsEmail.EOF
If Len(rsEmail("Email") & "") > 1 Then
strEmailAddress = strEmailAddress & rsEmail("Email") & ";"
End If
rsEmail.MoveNext
Loop
strEmailAddress = Left(strEmailAddress, Len(strEmailAddress) - 1)
On Error GoTo Err_Command5_Click
Exit_Command5_Click:
DoCmd.SendObject , , acFormatRTF, , _
, strEmailAddress, strSubject, strEMailMsg, True, False
rsEmail.Close
Set rsEmail = Nothing
Exit Sub
Err_Command5_Click:
If Err.Number = 2501 Then
Resume Next
Else
MsgBox Err.Description
Resume Exit_Command5_Click
End If
End Sub