Reading Email Programmatically - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Reading Email Programmatically

Jawa2007Jawa2007 Posts: 1Member
Hello folks. I am trying to write a program that will connect to a microsoft exchange server and read the email. I have heard that Microsoft MAPI is the way to go. I just have not figured out how to make it work. I have found lots of examples of how to send mail, but I have not been able to receive mail. Does anyone have a code sample I could check out? Is there a book someone can recommend? I have tried the following code and when I get to the CreateObject line I get an error like "Cannot create ActiveX control." Does anyone have suggestions? Is there a step I missed in the IDE?

Imports System.Web
Imports MSMAPI

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim session As New MSMAPI.MAPISession
Dim m As New MSMAPI.MAPIMessages

session = CreateObject("MAPI.Session", "")
session.UserName = "developertest"
session.Password = "developer"

Catch ex As Exception
MessageBox.Show("not signed it")
End Try



End Sub
End Class
Sign In or Register to comment.