Link to home
Create AccountLog in
Avatar of Antonio King
Antonio King

asked on

Outlook macro to extract address from body of email into CSV

Wondering if anyone can help me with an Outlook macro?

I need a macro that will run against the selected folder.
The macro should review all items with the subject "[Postmaster] Email Delivery Failure]"
It should then extract the email address found within the body of the email and save it to a csv file

Each item found with an email address in the body should be appended to the csv file.

Many thanks!
Avatar of Bill Prew
Bill Prew

How can the email address be located in the body of the email?  Please provide sample(s).

Is this a typo for the subject, or does it look exactly like that?

"[Postmaster] Email Delivery Failure]"


»bp
Avatar of Antonio King

ASKER

Hi bill
That is a typo. Well spotted
The subject is "[Postmaster] Email Delivery Failure"

A typical email body would look like this...
This is a delivery failure notification message indicating that an email you addressed to email address :
-- email@domain.com

could not be delivered. The problem appears to be :
-- Recipient email server rejected the message

Additional information follows :
-- delivery error: dd This user doesn't have a yahoo.com account (email@domain.com) [0] - mail.server.com

This condition occurred after 1 attempt(s) to deliver over a period of 0 hour(s).

If you sent the email to multiple recipients, you will receive one of these messages for each one which failed delivery,  otherwise they have been sent.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer