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.

\TITLE Email Distribution \SENDER Peter Rabbitt <peterr@example.com> \NOSIG Y John & Jenny Arnold <johnarnold@somedomain.com> David & Jan Barker <jbarker@someotherdomain.org> etc,etc

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:

2,1,"70937460:My mailbox","","My mailbox" 0,0,"750EE41A:1A94:FOL07093","70937460:My mailbox","Main" 0,0,"6670FCDB:1A95:FOL04816","70937460:My mailbox","Sent" 1,1,"0E457462:Developer","70937460:My mailbox","Developer" 0,0,"46FBE5F3:1A97:FOL024EB","0E457462:Developer","Microsoft"

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. :)

Thanks,

Peter


In reply to Parsing email files, what are the best modules ? by peterr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.