Results 1 to 4 of 4

Thread: Outlook Object??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Location
    South Africa
    Posts
    76

    Thumbs down

    I've been using the outlook object, to fetch mail from my mailserver, and insert it into my SQL server database. I am inserting the 'from' address into the database, but, the outlook object does not support a from field! It gives me the persons name who sent the mail, but not the EMAIL address, which I need!

    anybody tried this before?
    =)

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    We fought this battle last week. We looked at several ideas and concluded (with the help of MSDN stating such) that the SendersName is the only field that you can use and that is only good if the user is within your exchange system. It appears that you can create a reply and then parse it out of the body of the message, but that might not be consistant.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Location
    South Africa
    Posts
    76

    Unhappy Outlook

    So, basically, using the outlook object, there is no way I can get the Senders Email Addres? I can only get thier name?
    =)

  4. #4
    Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    53
    You could try the following sample code module:

    Option Explicit

    Private ol As New Outlook.Application
    Private ns As Outlook.NameSpace
    Private itms As Outlook.Items

    Public Sub main()

    Dim reply As Outlook.MailItem
    Dim i%, j%
    Dim s$

    StartOutlook

    'Retrieve a collection of mail messages in the inbox.
    Set itms = ns.GetDefaultFolder(olFolderInbox).Items

    'Display The subject and Return Adress for the first Message
    With itms(1)
    s = "Subject: " & .Subject & vbCrLf & "From: "
    Set reply = .reply
    For i = 1 To reply.Recipients.Count
    s = s & reply.Recipients.Item(1).Address & vbCrLf
    Next i
    End With
    MsgBox s, vbOKOnly + vbInformation, "OUTLOOK INFO"

    CleanUpOutlook

    End Sub

    Function StartOutlook()

    'Return a reference to the MAPI layer.
    Set ns = ol.GetNamespace("MAPI")

    'Let the user logon to Outlook with the Outlook Profile dialog box, then create a new session.
    ns.Logon , , True, True

    End Function

    Function CleanUpOutlook()

    'This logs the current profile off of a session.
    ns.Logoff

    'Release all memory.
    Set ns = Nothing
    Set ol = Nothing

    End Function

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