Results 1 to 10 of 10

Thread: Retrieving Email Address form Outlook

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    Vermont
    Posts
    2
    Does any one know how to retrieve an email address from an outlook email? I am using this method to retrieve the email attachments, Sender name and subject but I can't figure out how to retrieve the senders email address.

    Set olapp = CreateObject("Outlook.Application")
    Set mnamespace = olapp.GetNamespace("MAPI")
    Dim allmessages As Items
    Set allmessages = mnamespace.GetDefaultFolder(olFolderInbox).Items

    Any help would be appreciated. Thanks.
    Mel

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    How about trying the ReplyRecipient.Address. I haven't done this before, but it looks promising.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    Vermont
    Posts
    2
    Maybe I am missing something but I can't find the ReplyRecipient.address property. Where is it?

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    ReplyRecipient is a property of the MailItem object that we probably fill in. I can't find the e-mail address of the sender either. I'll look around and see what I can find.

  5. #5
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    I found the answer. Not a good one.

    "In Microsoft Outlook, only the sender's Display Name of the original message is added to the body when a message is forwarded or replied to. If the recipient wants to send mail to the original sender, only the Display Name is available. In a Microsoft Exchange Server organization, it is possible to look up the address in the global address list; however, if the original sender is outside of the Exchange Server organization and has no custom recipient entry, it may be impossible to find the e-mail address of the original sender."

    Sorry.



  6. #6
    New Member
    Join Date
    Oct 2000
    Posts
    2

    Question How do you get that info from EXCHANGE?

    HDR,
    I see that you found a way to do a lookup of a users email address in exchange. I was looking for a way to do that also. Could you let me know how to do it?
    I am looking to send a reminder email to each user, whos NT user names are in a list.
    Thanks for the help.
    And if your really feeling like a challenge, maybe you know of or can find out a way to just post a reminder instead of sending them an email!

    Thanks for the help.
    NM

  7. #7
    New Member
    Join Date
    Oct 2000
    Posts
    2

    Lightbulb solution!

    I found an ingenious solution to this problem (i think). Here's how to get the e-mail address of an incoming e-mail:

    1. Install the Generic / Text Only printer in Windows 98. Set it to print to a file.

    2. In Visual Basic, use the line "mailitem.PrintOut" (where mailitem is the Outlook.MailItem that you want to get the e-mail address of).

    3. Open the file you just printed, at the top you'll see:

    To: Real Name [[email protected]]

    4. grab this address!

    Right now, the only problem I've encountered is that the Windows print driver asks you for the file that you want to print to. There's gotta be a workaround for this.

    Hope this helps. :-)

    - GM

  8. #8
    New Member
    Join Date
    Oct 2000
    Posts
    1

    Recipients e-mail address

    Hi,

    Which version of Outlook are you using?

    In Outlook 2000 I think it is possible to do the following:
    Access the ReplyRecipients collection in the mailitem you are interested in. From that you can extract the recipients E-mail address.

    I haven't tried this though but it looks like it should work.

    Good luck !
    Cubic

  9. #9
    New Member
    Join Date
    Nov 2001
    Location
    mumbai
    Posts
    7
    dim allmessages as outlook.items
    dim item as outlook.mailitem
    Set olapp = CreateObject("Outlook.Application")
    Set mnamespace = olapp.GetNamespace("MAPI")
    Dim allmessages As Items
    Set allmessages = mnamespace.GetDefaultFolder(olFolderInbox).Items
    for each item in allmessages.items
    msgbox item.sendername
    next

    if item.sendername just gives u sender name and not email address then u have to parse sender emailid from
    item.Reply.Body

    try hope will work

  10. #10
    New Member
    Join Date
    Nov 2002
    Location
    UK
    Posts
    1

    Workaround

    Hi.

    I read this thread with interest (noting it is a couple of years old!). I am currently involved in a project that requires obtaining the sender's email address using the Outlook object model.

    I am glad to say that my project is near completion, and that I have overcome the problem detailed in this thread.

    To obtain the sender's email, try this:

    function FindSender(theItem as MailItem) as string
    Dim reply As MailItem
    Dim sender As String

    Set reply = theItem.reply
    sender = reply.Recipients(1).Address
    FindSender = sender
    reply.Delete
    end function


    The (rather obvious, once I finally stopped pulling my hair out) logic is that any reply will obviously be TO the sender, so the recipient can simply be obtained from this.

    Note that the only exception to this is when the ReplyTo address in the email is different to that of the sender, but this isn't an issue in my case and I doubt it will be in most others.


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