Extract Sender Email Addresses From Outlook

0 views
Skip to first unread message

Laila Berri

unread,
Aug 5, 2024, 2:25:25 AM8/5/24
to leyspilutvab
Ive got to send a bulk email out to a bunch of people in reply to emails they sent me. I've got all the original emails stored in a single outlook folder. I want to extract all of the reply addresses from the emails in that folder so I can send an email to all of them.

The article Extracting Email Address from Outlook 2007 folder shows you how to export the FROM address of these emails, however a large amount of them came from a web service that sends emails 'on behalf of' the person I'm trying to mail to. So I need the reply-to address, and the export wizard doesn't do that.


I am trying to extract the sender's email address from outlook 2013 using win32 package in python. There are two kinds of email address type in my Inbox, exchange and smtp. If I try to print the the sender's email address of Exchange type, I am getting this:


Firstly, your code will fail if you have an item other than MailItem in the folder, such as ReportItem, MeetingItem, etc. You need to check that the Class property (exposed by all Outlook objects) is 43 (olMail).


There are some answers here based on the NK2 file and utilities that read it, but it's not the solution because the NK2 file will not always have every recipient you've ever emailed for the following reasons:


Basically you can use the Outlook Import/Export function to achieve this. It's typically used to migrate the actual emails, but it suits the purpose of getting just the email addresses (or any other value for that matter).


There's a file called something.NK2 - this lists all of your autocomplete addresses. You can basically copy and paste the file and viola your new outlook has your old autocomplete. I'm sure that file can be read too, try googling .NK2 reader.


Hi Mariusz,



Email address representation in this format is a well known issue with Microsoft Outlook that can be caused due to a number of reasons, the typical is incorrect configuration of Exchange Server. It is not a limitation at Aspose.Email end but an issue related to email retrieval from Exchange server, and hence, Aspose.Email can not help in this regard.






Thanks for the explanation. I found another issue. If you try to open/read some msg file where there is a Sender with that LDAP name instead of the email address, Aspose.Email return null from message.getFrom() although I can see the sender when I open the msg file in Outlook or any MSG Viewer. It should return at least the sender name. An example file can be provided.


If I open that message with Outlook or with Message Viewer Lite or MSG Viewer tool I can see the recipient name and the LDAP info. Is there at least a way to extract the sender name and not the email address?


I use both Mail and Spark.

I'm wondering if there is a convenient way to get the first name of the sender?

What I would like to do is: when I reply someone's email, the reply email will begin with:


Just one question: Your script is able to handle multiple selections as well as single selection, which is great.

For now, in my usage, I mostly need only the sender name of one email. So I tried to simplify the script as follows:


My solution is a Hotkey driven macro that I use in addition to Reply. This macro has a rules file for specialized greetings for various email addresses, and it has rules for handling things generically.


It is easy to extract email addresses from one email message with copying and pasting. But how to extract all email addresses from folders in Microsoft Outlook? Here we will walk you through extracting all email addresses from specified folders in Microsoft Outlook, and exporting as other files in detail.


If you have Kutools for Outlook installed, you can apply its Add from Message feature to extract all email addresses from all emails in a mail folder, and then save as individual contacts quickly in Outlook.


Kutools for Outlook also provides the Add to Group feature to extract email addresses of senders or recipients from all emails in a certain mail folder, and save extract email addresses as contact group members in bulk.


I'm trying to extract all unique "FROM" emails from an email account and can't seem to find the "From" data-column. I've tried unpivoting all the columns in "Edit Query" but none of them contain the senders details, only the To/Cc/Bcc.

Anyone know how to get it?




For your requirement, I'd like to suggest you enter to 'query editor' to spilt 'Sender' and 'Attributes' columns to new table.

Then expand 'Sender.Address' and 'Attributes.ConversationTopic' to get sender and mail topic.


This tutorial explains how to extract email addresses from emails stored in Microsoft Office Outlook, Outlook Express and Thunderbird, using Email Address Collector. Also see the video tutorial: extract email addresses from emails.




In order to extract email addresses from emails, you firstly have to select the email client from which to extract from. Email Address Collector supports all Windows versions of the following email clients: Office Outlook, Outlook Express, Thunderbird and Eudora.


You can now select to extract email addresses from email folders, Contacts folders or from all mailbox folders. For example, if you want to extract email addresses from your Outlook Inbox folder, simply select the Inbox folder in the top left panel:

Extract email addresses from email folders


After you choose how to scan the email folder(s), Email Address Collector will prompt you with extraction filtering options: you can choose to extract all email addresses that it can find in the selected folder(s) or you can choose to filter email addresses based on several options that are grouped in two filters sections:

Extract from emails using filters


I configured a process model to trigger on recieving an email, with in the process model I am using a Send E-mail smart service to send a confirmation email to the one who sends the mail, confirming them that the instance is triggered.


AFAIK, there is no option to get an email as reply to the initial email. As it is going to be a confirmation email, may be you can create a template that looks like an Reply, or attach the expected email contents that is used to trigger the process.


To send the confirmation email as a reply, extract the sender's email address from the received email and configure your Send Email smart service to use it as the recipient. Set the email headers to indicate it's a reply and include the necessary confirmation content. Test to ensure it works properly.


Harvesting addresses is pretty simple. I showed how to do this for meetings in this earlier post. marthasmith wants to take it a step further and collect address for different Outlook items types (e.g. emails, addresses, contacts, etc.) and she wants to do this for all folders. The first requirement calls for detecting the item type being processed since different types of items have different properties. The second requirement can be satisfied through a recursive loop.


I was looking for something like this and it works a charm,

The only criticism is the fact that there is no check for duplicates

I came up with this solution and it works:

Add this at the top

Dim oArray() As Variant, x As Integer, y As Integer


Thanks for the feedback and the improvement to the solution. I recommend making one further refinement. Instead of using an array to store the addresses I propose using a Scripting Dictionary object. That will save the repeated iterations through the array looking for matches as well as resizing the array each time we add an address to it. Something like this. You will need to add a reference to the Microsoft Scripting Runtime in order to use this.


HI David

Thank you very much. This is what I am looking for.

But seems it only work when the subfolder has been selected, when I trying to run under the inbox folder, it give me runtime error 440.

Can you help?

Henry


Hi David

In other VBA relating to Outlook I have had a problem with: Add and request read receipts and delivery notifications. I think that could cause issues. I suggest to test this. Ie. change the code so it skips any request read receipts and delivery notifications. Agree?


Hi David

Have tested and now it run without error. Perfect. Thanks. Can we go to part B (sender name, email addresses and subject)?

If you want to spend the time, we can try to find the reason to the error later, but that is not urgent.

Thanks again and look forward to hear from you.


Concerning the additional details, why does it matter what message an address came from, especially since the solution is removing duplicates? Unless an address only appears once, then the additional details are going to come from the first message the address appears in. For example, say that the address j...@company.com appears in five messages. The code is only going to harvest it once, from the first message it appears in. That may or may not be the most significant of the messages the address is in. It may not even be a message. The first appearance might be in an appointment or a distribution list, in which case the code would get the details from there and would never record anything about all the other items that address appears in.


Please try this version. It should harvest the addresses from every item in every folder you have. It also de-duplicates the addresses. Depending on how many folders you have and how many items are in each folder, it may take a long time to run.

3a8082e126
Reply all
Reply to author
Forward
0 new messages