Forum Discussion
Sending Email from Access to Outlook (Works with Office Pro Plus 2016)
My company is switching users from Office 2016 to Microsoft 365. I have a database that send emails out to suppliers. The code has worked fine for years. Now, after the upgrade to 365, I now get an error when sending the email (.send). The error message basically says, try again later. If I display the email then manually click send, it works.
Did something change with 365 that would cause this? My company is quite large so IT is problematic to work with. We are using a generic email account create for our department.
Any ideas would be appreciated.
- Can you share the code you are using? Do you have a reference to the Outlook object or are you late binding and using Object type and GetObject or CreateObject?
- DS590Copper Contributor
I found the solution to the problem. It was not related to early or late binding.
I was using outlook.mailitem.to in order to add the email addresses. I guess there was a change and this is no longer valid.
In order to assign email address I found the following code to work. This is not the complete code.
Dim appOL As Outlook.Application
Dim objMail As Outlook.MailItem
Dim Email_Recipient As Outlook.RecipientSet appOL = GetObject(, "Outlook.Application")
If appOL Is Nothing ThenSet appOL = CreateObject("Outlook.Application")End If
With objMail
Set .Email_Recipient = .Recipients.Add(VendorContactEmail).Send
End With