-
I need some help to receive e-mail in a VB 6.0 application and parse the delimited text and insert it to a database. I will use outlook but do not know how to do this. I can find documentation on how to send mail but very little on how to receive it. I can handle the parseing and database part but need help with reading the message body of the E-mail message. Any help will be appreciated.
Thanks,
Joe
-
I hope this helps. You need to reference the microsoft outlook 8.0 library in your project, and also need to be assigned as a delegate in the mailboxes you are working in. Good luck
Option Explicit
Public OlApp As outlook.Application
Public olNameSpace As outlook.NameSpace
Public olRecipient As outlook.Recipient
Private Sub cmdGetEMail_Click()
Dim olMail As outlook.MailItem
Dim strFind As String
strFind = "[Subject] = ""Subject of e-mail to read"""
Set olRecipient = olNameSpace.CreateRecipient("MailBox")
Set olMail = olNameSpace.GetSharedDefaultFolder(olRecipient, olFolderInbox).Items.Find(strFind)
' At this point, do your stuff
Set olMail = Nothing
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set OlApp = New outlook.Application
Set olNameSpace = OlApp.GetNamespace("MAPI")
olNameSpace.Logoff
olNameSpace.Logon "LogonID", "Password", False, True
End Sub
Private Sub Form_Unload(Cancel As Integer)
olNameSpace.Logoff
Set OlApp = Nothing
Set olNameSpace = Nothing
Set olRecipient = Nothing
End Sub
-
Receiving E-mail
Thanks, I will try this, I assume delegate is Username?
Thanks,
Joe
-
Nope. Right-click on the Inbox icon in your toolbar in Outlook. Select Properties. Look on the Permissions tab. You need the logon that this program will use to be in this list, with the appropriate permissions checked, on every mailbox that it will look at.
-
receiving e-mail
Still having problems, I am using outlook 2000 (9.0 in VB).
I not see where to set permissions. I tryed the right click on the inbox but, got a different list from what you talking about. When I run the code in VB I get this message ("The message interface has returned an unknown error. If the problem persists, restart outlook.
I appreciate your help.
thanks
Joe
-
recieving E-mail
Got it working with the following code:
Set olMail = olNameSpace.GetDefaultFolder(olFolderInbox).Items.Find(strFind)
Thanks,
JOe