Senders' Address in Outlook 2002 Inbox

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Senders' Address in Outlook 2002 Inbox

Post by armsys » Mon Feb 03, 2003 6:41 am

How can the sender's email address be extracted from all emails stored in the Inbox folder of Outlook 2002? Apparently most VBA for Outlook code won't compatible with VBscript.

Without VBScript, the sender's address can still be extracted by Macro Scheduler script, but it takes a long time.

I'll be grateful for your help.

Lumumba

Post by Lumumba » Mon Feb 03, 2003 4:47 pm

Export all mails from the inbox folder to a file e.g. C:\InboxContent.txt
Search for "From:"

Code: Select all

Run Program>cmd /c find "From:" C:\InboxContent.txt > C:\MailFrom.txt
Take result/lines from MailFrom.txt
Extract sender from line

Code: Select all

ReadLn>...,from
Length>from,fromlength
Sub>fromlength,6
MidStr>from,7,fromlength,sender
Message>%sender%

Sample - InboxContent.txt

-----Original Message-----
From: [email protected]
Sent: 09 October 2002 16:44
To: [email protected]
Subject: HongKong in spring

Hi Mao,
maybe we should visit Hong Kong next spring.

Rgds,
John

-----Original Message-----
...

Lumumba

Post by Lumumba » Mon Feb 10, 2003 9:54 am

Hi Armstrong,
so - how you've solved that issue ?

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Feb 10, 2003 3:36 pm

Hi Lumumba,

Thanks for your very kind assistance. Sorry for not being able to reply your post earlier. Actually I already wrote a MacroScript to extract senders' email address. My algorithm was quite simple. First, it simulates a dummy reply. Second, it extracts the Reply To email address. Then, the process is repeated until all emails exhaust. Surprisingly, the speed is reasonably acceptable, even for thousands of emails.

On the other hand, your algorithm involves huge amount of text read/write. It's hardly practical for a large number of emails.

Again, thanks for your help.

Lumumba

Post by Lumumba » Mon Feb 10, 2003 8:09 pm

Manualy:
a) export all mails from a folder (e.g. inbox) to a file

Script:
b) find/filter for "From:" and pipe matching lines to a file
c) extract address' from every single (looped) and write it to a file

Benefit: run it as a background task!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Feb 10, 2003 11:58 pm

Hi Lumumba,

Now I can see the advantage of converting all emails into a text file format. In order for a MacroScript to run free of glitches, in most cases we shouldn't touch the keyboard until it's finished. Hence, my aglorithm can't work in the background like yours. In addition, I concede that your algorithm will win the speed contest because no time-consuming GUI is involved. Thank for illuminating a wonderful script idea.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts