Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read email programmatically? 1

Status
Not open for further replies.

SuperGeek2006

Programmer
May 22, 2006
3
US
Hello,

I need to write an applcation that reads mail from a microsoft exchange server using VB.NET. I have heard that using MSMAPI is the way to go. However, it seems like all the code samples I can find are for using MAPI to send mail. Does anyone have a code sample of how to read mail? I have tried fumbling with MAPI with the code below and on the CreateObject line I get and error like cannot create active x control. Does anyone know why this might be? Does anyone know where I can find a code sample that works? Any recommended books? Any advice would be greatly appreciated.

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", "exchange.mailserver.com")
session.UserName = "developertest"
session.Password = "developer"
Try
session.SignOn()

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

'session.DownLoadMail()

'm.Fetch()



End Sub
End Class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top