I'm trying to send an e-amil message automatically when a certain condition occurs. I have found the following code at this sight however I'm having a problem with it. It appears to me doing enverything ok However when the e-mail is sent I get a message saying the message was undeliverable because I think the above code is woderfull for my app however could someone please explain why my e-mail is not getting delivered. No transport provider was available for delivery to this recipient.

What am I doing wrong?

Private Sub CmdSendMail_Click()

MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.MsgSubject = "Testing Auto e-mail"
MAPIMessages1.MsgNoteText = "This is the body of the email"
'MAPIMessages1.MsgOrigAddress = Me.MAPIMessages1.
MAPIMessages1.RecipAddress = "[email protected]"
MAPIMessages1.RecipDisplayName = MAPIMessages1.RecipAddress
MAPIMessages1.Send (True)
MAPISession1.SignOff


End Sub