blob: ff4e35ae52791396e6fe02b9a14885ef67b2f071 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/env perl
#-*- perl -*-
#
# Copyright (C) 2004 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML$
#
use strict;
use Carp;
use lib qw(../../cpan/lib);
use Mail::Message;
my $tmp = "/tmp/buf$$";
for my $f (@ARGV) {
my $fh = new FileHandle $f;
my $wh = new FileHandle "> $tmp";
my $obj = Mail::Message->parse( { fd => $fh } );
my $hdr = $obj->whole_message_header();
my $from = $hdr->get('from');
use Mail::Address;
my (@addrlist) = Mail::Address->parse($from);
for my $a (@addrlist) {
my $address = $a->address();
print "address: $address\n";
my $comment = $a->comment();
print "comment: $comment\n";
my $phrase = $a->phrase();
print "phrase: $phrase\n";
}
print "\n";
}
unlink $tmp;
exit 0;
|