FAQ 9.14: How do I parse a mail header? 
Author Message
 FAQ 9.14: How do I parse a mail header?

(This excerpt from perlfaq9 - Networking
    ($Revision: 1.25 $, $Date: 1999/04/14 03:46:19 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://www.*-*-*.com/
if your negligent system adminstrator has been remiss in his duties.)

  How do I parse a mail header?

    For a quick-and-dirty solution, try this solution derived from page
    222 of the 2nd edition of "Programming Perl":

        $/ = '';
        $header = <MSG>;
        $header =~ s/\n\s+/ /g;      # merge continuation lines
        %head = ( UNIX_FROM_LINE, split /^([-\w]+):\s*/m, $header );

    That solution doesn't do well if, for example, you're trying to
    maintain all the Received lines. A more complete approach is to use
    the Mail::Header module from CPAN (part of the MailTools package).

--
    last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
    That's gonna be tough for Randal to beat...  :-)



Sat, 27 Oct 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. FAQ 9.14: How do I parse a mail header?

2. FAQ 9.14: How do I parse a mail header?

3. FAQ 9.14: How do I parse a mail header?

4. FAQ 9.14: How do I parse a mail header?

5. FAQ 9.14: How do I parse a mail header?

6. FAQ 9.14: How do I parse a mail header?

7. FAQ: How do I parse a mail header?

8. FAQ: How do I parse a mail header?

9. FAQ: How do I parse a mail header?

10. FAQ: How do I parse a mail header?

11. FAQ: How do I parse a mail header?

12. FAQ: How do I parse a mail header?

 

 
Powered by phpBB® Forum Software