Hi,
I used a example of planet source code for send email for MAPI... it works perfectly in the first email that I send, however, when a click again in the send button, with a different message to other email, I have an error - I just get to send one message... to send two, I need close the program and open it again to send...
I'm using this code:
-----------------------------------------------------------------------------
On Error GoTo mailerr: 'go to the error handling bit If there is an error
MAPISession1.SignOn 'sign on
If MAPISession1.SessionID <> 0 Then 'signed on
With MAPIMessages1
.SessionID = MAPISession1.SessionID
.Compose 'start a new message
.AttachmentName = Text5 'attachment name
.AttachmentPathName = Text4 ' attachment path (get this from the text box or a default dirrectory)
.RecipAddress = Text1 'set the receiver's email To the one they specified (again, text box or a default address)
.MsgSubject = Text2 'set the subject
.MsgNoteText = Text3 'message text
.Send False 'don't display a dialog saying it was sent
End With
Exit Sub
End If
mailerr: 'error handling
MsgBox "Error " & Err.Description
-----------------------------------------------------------------------------------------
What a problem?
Thanks
|