My SMTP server got 100's of errors when sending lots of emails. Now have lots of .BAD files each one containing an error
message and somewhere in the middle, the actual email address it was supposed to be sent to.
What is the easiest way to extract from each file "just" the "email address", so that I can have a list of the actual failed emails?
I can code in C# and any suggestion will be truly welcomed.
BAD SAMPLE TEXT:
From:
[email protected]
To:
[email protected]
Date: Tue, 25 Sep 2012 12:12:09 -0700
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="9B095B5ADSN=_01CD9B35032DF58000000066my.server.co"
X-DSNContext: 7ce717b1 - 1386 - 00000002 - C00402D1
Message-ID:
Subject: Delivery Status Notification (Failure)
This is a MIME-formatted
message.
Portions of this
message may be unreadable without a MIME-capable mail program.
--9B095B5ADSN=_01CD9B35032DF58000000066my.server.co
Content-Type: text/plain; charset=unicode-1-1-utf-7
This is an automatically generated Delivery Status Notification.
Unable to deliver
message to the following recipients, due to being unable to connect successfully to the destination mail server.
[email protected]
--9B095B5ADSN=_01CD9B35032DF58000000066my.server.com
Content-Type: message/delivery-status
Reporting-MTA: dns;my.server.com
Received-From-MTA: dns;Social
Arrival-Date: Tue, 25 Sep 2012 11:45:15 -0700
Final-Recipient: rfc822;
[email protected]
Action: failed
Status: 4.4.7
--9B095B5ADSN=_01CD9B35032DF58000000066my.server.com
Content-Type: message/rfc822
Received: from Social ([127.0.0.1]) by my.server.com with Microsoft SMTPSVC(7.5.7601.17514);
Tue, 25 Sep 2012 11:45:15 -0700
======================================
...and lots more text after
=====================
Mainly I want to find the "
[email protected]" email right in the middle...