I am developing an app to send MAPI mail from
vb.net. I must send MAPI and not SMTP, as many of the junior managers in my company do not get SMTP mail addresses.
After a week of experimentation and advice, I finally got past a multitude of error messages but still have a problem. I get past the Logon ok, but when I hit the following line to start a message (see below), it simply hangs indefinititely. Is there something that must be set up on the Exchange 5.5 box? Is there a log file on the Exchange box where I can see what is happening? Here is the code:
' start the session
Dim objsession As Object
objsession = CreateObject("mapi.session")
Dim profileinfo As String
profileinfo = "exchangeserver" & vbLf & "mailboxalias"
objsession.Logon("", "", False, True, 0, True, profileinfo)
' start the message
Dim objmessage As Object
objmessage = objsession.Outbox.Messages.Add '<==== HANGS HERE ======
objmessage.subject = "This is a test."
objmessage.Text = "This is the message text."
' add receipients
Dim objRecipients = objmessage.Recipients
objRecipients = objmessage.Recipients.Add
objRecipients.add("RecipientAlias")
' check for valid recipient
objRecipients.Resolve()
'Send the message
objmessage.Send()
'Logoff
objsession.Logoff()
objsession = Nothing
Any assistance would be greatly appreciated.