Hi,
I am trying to send emails from access via outlook, which worked completely fine until recently.
Before I used to be able to write/send automatically generated emails on both my laptop and my work computer.
Now? On my laptop .send results in the email becoming stuck in the outbox. On my workcomputer, .send does nothing at all. ".Display" works and all the contents of the email are as expected, but .Send does not send the email and close the email window, it leaves the email window up and sends nothing - this is with the On Error GoTo 0 line, without the line error 287 pops up. This error does not pop up on my Laptop but it does pop up on my work computer.
My program looks like the following:
Code:
Option Compare Database
Sub test_email()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strBody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
strBody = "This is a test email. test."
'On Error Resume Next
With OutMail
.Display
.To = "someone@somewhere.com"
.Subject = "abc 123"
.Body = strBody
.Send 'Error 287 on PC, works fine on LAPTOP.
End With
'On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Any ideas?