-
I am trying to send an email using MAPI and everything works fine until i send it then i get the following error message in my outlook
No transport provider was available for delivery to this recipient.
here is the code:
Dim x As String
Dim y As String
x = rtfCopylstReport.Text
y = InputBox("Please enter an email address.", "EmailAddress")
MAPISession1.SignOn
MAPIMessages1.SessionID = Me.MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.MsgSubject = "Search Results"
MAPIMessages1.MsgNoteText = x
MAPIMessages1.RecipAddress = y
MAPIMessages1.RecipDisplayName = MAPIMessages1.RecipAddress
MAPIMessages1.Send True
MAPISession1.SignOff
What am i doing wrong?
Thanks,
Cady
-
never mind, i figured it out!!!!
thanks anyway.
Cady
-
Hi cady,
I hit the same problem when using email code similar to you. Would you tell me how you solved it ?
Thanks
KM Chong
-
Here you go kmchong, on this example i have x=rtfcopylstreport.text because i wanted to automatically put the email contents in, all the user had to do was enter an email address in the input box which was then automatically added to the email, then hit send. I did put some information in the ErrorHandler that allowed for errors but this works great.
Dim x As String
Dim y As String
x = rtfCopylstReport.Text
y = InputBox("Please enter an email address.", "Email Address")
On Error GoTo ErrorHandler
MAPISession1.SignOn
MAPIMessages1.SessionID = Me.MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
MAPIMessages1.RecipAddress = y
MAPIMessages1.MsgSubject = "search results"
MAPIMessages1.MsgNoteText = x
MAPIMessages1.ResolveName
MAPIMessages1.Send True
MAPISession1.SignOff
Let me know if this doesn't make sense, or doesn't help.
Cady