Results 1 to 3 of 3

Thread: MAPI error handling

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    Here and There
    Posts
    92

    MAPI error handling

    Hi folks can someone help with a little problem about sending emails from vb6 via outlook etc. the following code is the main extract from my code. The process works ok providing OK/YES is selected at each of the dialogs
    1. 'profile not valid/enter valid name' (OK and use default)
    2. a program is trying to send emails (OK these)
    etc etc

    and proceeding through BUT if the user selects the CANCEL button at any time i get login failure error(s) code 32003

    can someone please show me how to trap this error?

    VB Code:
    1. Dim objUser As COO.clsUser
    2. Dim strTemp As String
    3. Dim strSubFuncName As String
    4. Dim strEmailAttached As String
    5. Dim strEmailGuid As String
    6.  
    7. strSubFuncName = "frmMain:MailSession"
    8. On Error GoTo ErrHandler
    9.  
    10. MailSession = False
    11. strEmailAttached = ComputerName
    12. Set objUser = New COO.clsUser
    13. objUser.GetData
    14.  
    15. MAPISession.NewSession = True
    16. MAPISession.UserName = GetCurrentUser
    17. MAPISession.Password = ""
    18. MAPISession.LogonUI = True
    19. MAPISession.SignOn
    20. MAPIMessages.SessionID = MAPISession.SessionID
    21. MAPIMessages.Compose
    22. MAPIMessages.MsgIndex = -1
    23. MAPIMessages.RecipDisplayName = objUser.RecipientName
    24. MAPIMessages.RecipAddress = objUser.RecipientAddress
    25. MAPIMessages.AddressResolveUI = False
    26. MAPIMessages.ResolveName
    27. strEmailGuid = mstrGUID
    28. 'the companyname and companycode fields are the form's static fields
    29. strTemp = "EORDER: " & txtCompanyName.Text & " (" & txtCompanyCode.Text & ") ID: " & strEmailGuid
    30. MAPIMessages.MsgSubject = strTemp
    31. MAPIMessages.MsgNoteText = "Order"
    32. MAPIMessages.AttachmentPathName = App.Path & "\" & strEmailAttached & ".xml"
    33. MAPIMessages.send False
    34. MailSession = True
    35. Exit Function
    36. ErrHandler:
    37.     ErrorHandling strSubFuncName, Err.Number, Err.Description, Err.Source
    38.     MailSession = False
    39. End Function



    Edit: Added [vbcode][/vbcode] tags for clairty. - Hack
    Last edited by Hack; Jul 26th, 2005 at 07:30 AM.
    ab uno disce omnes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width