Search code examples
vbaemailoutlooksendkeys

Cant send email using VBA


I am creating a tool that will automatically dispatch emails out.

I have started to build it using very simple code as below:

Set outlookobj = New Outlook.Application
Set mitem = outlookobj.CreateItem(olMailItem)

With mitem
.To = "[email protected]"
.Subject = "TEST"
.Body = "test"
.Display
.Send

End With
End Sub

However the company I work for seem to have locked down .send. The email will create fine but will not send. Can anyone think of a way around this? I have considered using .sendkeys "^{ENTER}" however I know they are not a good way to doing things.

Thank you in advance Matt


Solution

  • I'm referring to this thread: Excel VBA sending mail using Outlook - Send method fails where the solution was the following:

    "Change .Send to .Display and put SendKeys "^{ENTER}" before the With mitem line."

    You can at least try it, maybe it works for you as well. :)