Results 1 to 6 of 6

Thread: MAPI problems

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39
    I'm using MAPI to send mail via MS Exchange Server. I've setup a Mail profile in Control Panel, and when I send mail from Outlook Express, everything works fine.

    However, when I try to use send mail from my VB app, I get the error message "Login Failed", even though my MAPISession has been started with no error and its SessionID property has been assigned to the equivalent property of my MAPIMessages control.

    Any ideas?

    Nahid Harjee

  2. #2

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39

    Unhappy Hello?

    No ideas from anyone?

  3. #3
    Guest
    Can you post your source code?

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39
    Here's my code (it's part of one of my classes):

    Private Const LDT_profile = "LDT"

    Private Sub Class_Initialize()

    With frmContainer.MAPISess
    .DownLoadMail = False
    .LogonUI = False
    .NewSession = True
    .UserName = LDT_profile
    .SignOn
    frmContainer.MAPIMess.SessionID = .SessionID
    End With

    End Sub

    Private Sub Class_Terminate()
    frmContainer.MAPISess.SignOff
    End Sub

    Public Sub sendMail()
    With frmContainer.MAPIMess
    .Compose
    .RecipAddress = "[email protected]"
    .MsgSubject = "Test"
    .MsgNoteText = "Test"
    .Send
    End With
    End Sub

    The sendMail method fails on the frmContainer.MAPIMess.Send method with either the error: Login has failed or Unspecified Error.

    Any help would be greatly appreciated.

    Nahid Harjee

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39

    Talking PROBLEM SOLVED!

    Don't worry about it, I've figured out the problem.

    For some reason, with one-off messaging (ie. sending messages to users not in an address book), you must specify the e-mail address of the recipient in the RecipDisplayName property and not in the RecipAddress property.

    So, it should be:

    .RecipDisplayName = "[email protected]"

    Don't ask me why, it's completely counter-intuitive. Ask M$.

    Nahid Harjee

  6. #6
    Guest

    Smile

    Yes, I had this problem before too.
    Another solution to it is to load Outlook Address book.

    Here is the code:
    .MsgIndex = -1
    .AddressEditFieldCount = 2
    .Compose
    .Show False
    .ResolveName
    .AddressResolveUI = True

    Anna Carlen

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