in reply to String Comparison Issue

Thank you moritz! That was spot on and the script is running as expected. Another question I have... Is there a way to only save a few sections of an email to file, or is it all or nothing? I would like only the following field: from, date/time, subject and the body.

Replies are listed 'Best First'.
Re^2: String Comparison Issue
by bart (Canon) on Jan 17, 2012 at 08:03 UTC
    So what parts do you want stripped? That list looks to constitute close to a full email, apart from a number of rather irrelevant headers — because headers are relatively small.

    Unless you want to strip out attachments. In that case, you'll most likely will have to parse the mails as MIME mail.

Re^2: String Comparison Issue
by Corion (Patriarch) on Jan 17, 2012 at 07:49 UTC

    Then, instead of printing the whole email body to the result file, extract the wanted headers and print those to the output.