Create csv file from text file.

Jan 13 2015 9:29 PM

Dear All,

we have text file which contains details for of email broadcast out to customers which has success and failure details like below

Sample File

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

Sending to: [email protected]
Queued: [email protected]
Failed: [email protected]
     - Error with sending recipients
     - Server says: 550 5.1.1 Recipient address rejected: User unknown
    - code:6 : RCPT Command Error. The current recipient was rejected by the mail server. If you know this is a good address then please make sure that you are using the proper mail server and authentication options for your current internet connection.
Sent: [email protected]
Sent: [email protected]

-----------

we have many failures and success in this file . So in this we need to read only failure emails and reason with the keyword Failed and write into .csv file with 2 columns as sample below.

like

Sample

email                        reason

[email protected]      *****

thinking to read info from text file with failure keyword and store inside data table and convert data table into excel or csv file.

but not sure how to read from text file all the info with keyword Failed.

Looking for sample code or advice for this.

Waiting for your valuable reply!!!

Regards,

Muthu


Answers (1)