Private Sub SendMailWithMAPI()
With MAPISession1
.DownLoadMail = False
.LogonUI = True
.SignOn
MAPIMessages1.SessionID = .SessionID
ComposeMessage
End With
End Sub
' Simply add the code to a form and run it. Private Sub ComposeMessage()
On Error GoTo ComposeErr
Dim subjecttxt As String
Dim address As String
subjecttxt = "insert subject text here"
address = "insert address here"
With MAPIMessages1
.Compose
.RecipDisplayName = address
.MsgSubject = subjecttxt
.ResolveName
.Send True
End With
Exit Sub
ComposeErr:
Debug.Print Err.Number, Err.Description
Resume Next
End Sub