Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading the sender of an email's address

Posted on 2000-02-29
6
Medium Priority
?
243 Views
Last Modified: 2010-05-18
I've written an office automation program that reads each message from Outlook 98 and filters them as necessary. It is finished except for one minor part. I cannot get the sender's email address 100% of the time, only about 80%.

I have looked through the entire message object on a email that doesn't give me its address (I can get the sender's name, but not the address).

Part of the code (relevant bits) is below, aswell as the statements I currently use to get the address (on the ones which have them).

-------------------------------

    Set dbMail = DBEngine(0).OpenDatabase("export.mdb")
   
    For Each msgOutlook In folderOutlook.Items
               
        If (msgOutlook.ReplyRecipientNames = "") Then
            strFROM = msgOutlook.SenderName
        Else
            strFROM = msgOutlook.ReplyRecipientNames
        End If

        'Rest of code

-------------------------------

'msgOutlook.ReplyRecipientNames' sometimes contain the address, otherwise I have to use 'msgOutlook.SenderName' which contains the name of the sender.

Anything I have missed that will get me the email address 100% of the time?


0
Comment
Question by:AdamWoodland
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 15

Expert Comment

by:cquinn
ID: 2569665
I believe the way to do it is to create a reply (which you later destroy without sending it) and look at the address property of the reply object.
0
 
LVL 15

Accepted Solution

by:
cquinn earned 400 total points
ID: 2569869
I have investigated further, and the way I do it using CDO is to look at the .sender.address property.

Using the outlook object model, you would need to look at message.recipients(0).address property of the temporary reply object - something like

oReply=msgOutlook.reply
strfrom =oReply.Recipients(0).Address
0
 
LVL 2

Author Comment

by:AdamWoodland
ID: 2569903
Cheers, I'll give that reply a go tomorrow.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:AdamWoodland
ID: 2571850
That seems to work for the messages that I couldn't get the address from (only the name), I used that in conjunction with my other code and between them it works 100% (so far, but I have to do some more testing).

Thanks again cquinn.

Adam
0
 
LVL 2

Author Comment

by:AdamWoodland
ID: 2571860
Oh yes - forgot to mention, your code should have been (in my case):

Set oReply = msgOutlook.Reply
strFROM = oReply.Recipients.Item(1).Address

:-)

Your suggestion helped, I only had to do a bit of tweaking.
0
 
LVL 2

Author Comment

by:AdamWoodland
ID: 2571867
That seems to work for the messages that I couldn't get the address from (only the name), I used that in conjunction with my other code and between them it works 100% (so far, but I have to do some more testing).

Thanks again cquinn.

Adam
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question