i use this code to send emails via outlook, it works fine if outlook is open and returns an exception otherwise, is there a way to send emails while outlook closed
here is my code:
here is my code:
Code:
Try
Dim oApp, oemail As Object
oApp = CreateObject("Outlook.Application")
oemail = oApp.createitem(0)
With oemail
.To ="me@test.com"
.CC = ""
.Subject = "Test Email"
'.BodyFormat = olFormatPlain
.Body = "Email Body"
'.Save()
'.Display()
.Send() 'You can automatically send the email without displaying it.
End With
oemail = Nothing
' oApp.Quit()
oApp = Nothing
Catch ex As Exception
MsgBox(ex.ToString)
End Try