Results 1 to 6 of 6

Thread: Recieving E-mail

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Atlanta
    Posts
    145

    Smile

    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

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    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


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Atlanta
    Posts
    145

    Smile Receiving E-mail

    Thanks, I will try this, I assume delegate is Username?

    Thanks,

    Joe

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    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.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Atlanta
    Posts
    145

    Smile 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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Atlanta
    Posts
    145

    Smile recieving E-mail

    Got it working with the following code:
    Set olMail = olNameSpace.GetDefaultFolder(olFolderInbox).Items.Find(strFind)

    Thanks,

    JOe

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