john_willmott
New member
- Local time
- Yesterday, 18:10
- Joined
- May 3, 2012
- Messages
- 5
I have have an access 2016 application which send emails via outlook with reports attached as pdf files - all working.
In outlook, my primary account is myemail@talktalk.net
I have now added a second account (gmail) to outlook and wish to use this account to send these emails.
The code in black text has been working.
I have tried adding the lines in red text - one at a time and both.
However, when previewing the email, it is being sent by myemail@talktalk.net, and not the @gmail account.
Dim olApp As Object
Dim objMail As Object
Set olApp = CreateObject("Outlook.Application")
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = strRecipients
.SendUsingAccount = "MyGmailAccount@gmail.com"
.Sender = "MyGmailAccount@gmail.com"
.Subject = strSubject
.Body = strBody
.Attachments.Add OutputPathFileAll 'all leagues pdf
.Attachments.Add OutputPathFileCup 'cup pdf
.Attachments.Add OutputPathFileLeague 'notice board per league pdf
If Me.CheckBox_SendWithoutChecking = True Then
.Send 'sends anyway
Else
.Display 'to show the email before sending
End If
End With
Any suggestions most welcome!
John
In outlook, my primary account is myemail@talktalk.net
I have now added a second account (gmail) to outlook and wish to use this account to send these emails.
The code in black text has been working.
I have tried adding the lines in red text - one at a time and both.
However, when previewing the email, it is being sent by myemail@talktalk.net, and not the @gmail account.
Dim olApp As Object
Dim objMail As Object
Set olApp = CreateObject("Outlook.Application")
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = strRecipients
.SendUsingAccount = "MyGmailAccount@gmail.com"
.Sender = "MyGmailAccount@gmail.com"
.Subject = strSubject
.Body = strBody
.Attachments.Add OutputPathFileAll 'all leagues pdf
.Attachments.Add OutputPathFileCup 'cup pdf
.Attachments.Add OutputPathFileLeague 'notice board per league pdf
If Me.CheckBox_SendWithoutChecking = True Then
.Send 'sends anyway
Else
.Display 'to show the email before sending
End If
End With
Any suggestions most welcome!
John