Attempting to send mail from within Access; get no errors, but no mail either

J

J Bard

Attempting to send mail from within Access; get no errors, but no mail
either.

Private Sub Command0_Click()
Dim oa As Outlook.Application
Dim ns As Outlook.NameSpace
Dim mi As Outlook.MailItem

Set oa = New Outlook.Application
Set ns = oa.GetNamespace("mapi")
Set mi = oa.CreateItem(olMailItem)

mi.To = "(e-mail address removed)"
mi.Subject = "test"
mi.Body = "a test"
mi.Send

Set oa = Nothing
Set ns = Nothing
Set mi = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top