|There's more than one way to do things|
Parsing email files, what are the best modules ?by peterr (Scribe)
|on Nov 10, 2003 at 05:14 UTC||Need Help??|
peterr has asked for the
wisdom of the Perl Monks concerning the following question:
Hi, I am finding my email distribution lists (Pegasus Mail) are not being kept up to date properly, and need to do the following:
1. Open the distribution list file (D:\Pmail\mail\list25B6.pml), and read it into an array. The file looks like this and has CR/LF's.
There are about 300 records in the file.
2. Open the list of all the email folders, this is stored in a file called hierarch.pm, format as follows:
This file also has CR/LF's. Any record starting with a value "0,0" is an email folder record, all the other are just logical representations of the email hierarchy (trays,etc). It is the email folder records that tell me the filename, for example, the second record shown above, is the "Main" folder, but at DOS is FOL07093.PMM
3. I then need to parse through every email folder, and look for any email headers with "From:" or "To:" , extract the email address, and if it isn't in the array from step 1, then put the details out to a file (or an array would be wiser, to check for dups as I parse through, then at the end, write out a file).
Some "To:" records could have multiple email addresses I guess, so I need to cater for that.
I have looked through examples and documentation on MIME::Parser, MIME::Tools and Mail::Address , but don't know which modules would be best suited for this type of work. I'm running it on a Win32 box, with Active state Perl, version 5.61
I'm a newbie to Perl, so please be nice to me. :)