Bernie Cosell <
ber...@fantasyfarm.com> wrote:
} I need to parse an email message and pull its various parts apart. Is
} there some not-so-difficult way to do it?
I'm still struggling with this and I can't figure what I'm doing wrong I've
been trying to start simple and ease my way into the morass [and thanks for
all the sample code and advice... alas, I'm still kinda lost]. I tried a
very very simple program:
-------------------------------------------------------
!/usr/bin/perl
use v5.10 ;
use strict;
use warnings ;
use Email::Simple ;
use Email::MIME ;
use Email::MIME::ContentType ;
use Email::Simple::Header ;
foreach my $msg (@ARGV)
{ checkmsg($msg) ; }
exit ;
sub checkmsg
{ my $email = Email::Simple->new($_[0]) ;
my @header_names = $email->header_names ;
say scalar(@header_names) ;
foreach my $header (@header_names)
{ say "$header" ; }
exit ;
}
---------------------------------------------------------
I tried it with a simple message [headers in part]
---------------------
[...]
Content-Type: multipart/alternative;
boundary="Apple-Mail=_AB70B143-E35C-42EB-86E0-84730EB5E4A7"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
Date: Sun, 9 Jan 2022 13:27:13 -0500
Subject: Getting involved on state level
Message-Id: <
840F9FC5-346F-4D62...@swva.net>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
X-PMFLAGS: 570966400 0 65537 PT49NPRZ.CNM
[...]
--Apple-Mail=_AB70B143-E35C-42EB-86E0-84730EB5E4A7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
--------------------------------------
I don't care about sorting out the MIME section, I just want to see if I
can get the headers parsed.. but when I try it:
D:\Desktop\>showparts Mailbox\multipart
0
What am I doing wrong? THANKS!! /bernie\