Below is some code I used that worked for me take a look...
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdSend_Click()
' On Error GoTo Error
If txtJobNumber = "" Then
MsgBox "You MUST specify a job number to send order...",
vbInformation, "No Job Number Entered"
Else
If LogOn = True Then
ComposeMessage
End If
cmdSend.Enabled = False
MsgBox "Your order has been processed Successfully...", vbInformation,
"Order Complete"
End If
'cmdSend_Exit:
' End Sub
'Error:
' Debug.Print Err.Number, Err.Description
' Resume Next
End Sub
Private Sub ComposeMessage()
On Error GoTo Error
mapMess.Compose
mapMess.RecipDisplayName = gstRecipient
mapMess.MsgNoteText = "Job Number : " & UCase(txtJobNumber.Text) &
vbCrLf & gstMessage
mapMess.MsgSubject = gstSubject
mapMess.Send False
ComposeMessage_Exit:
Exit Sub
Error:
Debug.Print Err.Number, Err.Description
Resume Next
End Sub
Private Function LogOn() As Boolean
' If a session is already started,
' exit sub.
If mapSess.NewSession Then
MsgBox "Order Already Sent...", vbInformation '"Session already
established"
Exit Function
End If
On Error GoTo ErrorLogInFail
With mapSess
' Set DownLoadMail to False to prevent immediate download.
.DownLoadMail = False
.LogonUI = True ' Use the underlying email system's logon UI.
.SignOn ' Signon method.
' If successful, return True
LogOn = True
' Set NewSession to True and set0
' variable flag to true
.NewSession = True
bNewSession = .NewSession
mapMess.SessionID = .SessionID ' You must set this before
continuing.
End With
Exit Function
ErrorLogInFail:
Debug.Print Err.Number, Err.Description
If Err.Number = 32003 Then
MsgBox "Canceled Login"
LogOn = False
End If
Exit Function
End Function
Private Sub Form_Load()
txtMessage.Text = gstMessage
End Sub
Destroyer