Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


MAPI error


MAPI error

Author
Message
KearBarl
KearBarl
Forum God
Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)

Group: Forum Members
Posts: 1, Visits: 1

Hi,

I'm getting this error with a vb program that send emails using MAPI.

MAPI Failure: valid session ID does not exist

Does anyone knows what could be happening?

Thanx!


Destroyer
Destroyer
Forum God
Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)

Group: Forum Members
Posts: 244, Visits: 188
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 Smooooth
Harishb Bhambure
Harishb Bhambure
Forum God
Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)Forum God (371 reputation)

Group: Forum Members
Posts: 1, Visits: 2
Even I have the Same problem. Whats the solution for this.
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search