dear all,
I have one a couple questions.
-. For the header, what if, I just need the subject, the from, and the 
recipient, what is the command? I read the manual in the 
https://metacpan.org/pod/Email::MIME#header 
<https://metacpan.org/pod/Email::MIME#header>, it does not tell me how to 
extract all of those.
-. And then, for the email contents of the body, it just shows Content-Type: 
multipart/alternative; boundary=f403045de9521d20cc054874ce1a 
instead of the contents of the email body. How to extract it into string 
because it is under html format.

> On Feb 16, 2017, at 11:45, Jim Gibson <jimsgib...@gmail.com> wrote:
> 
> 
>> On Feb 15, 2017, at 8:10 PM, Eko Budiharto <eko.budiha...@gmail.com> wrote:
>> 
>> dear Jim,
>> I tried to add lines to read file like this:
>> 
>> use Email::MIME;
>> 
>> my $file = '/var/qmail/mailnames/<domain 
>> name>/support/Maildir/cur/1487041394.M984019P23084V0000000000000803I0000000000E03878.ABCD.NET,S=3987:2,';
>> open my $ifh, '<', $file
>>  or die "Cannot open '$file' for reading: $!";
>> local $/ = '';
>> my $contents = <$ifh>;
>> close( $ifh );
>> 
>> my $mime = Email::MIME->($contents);  —> line 13
>> 
>> my @parts = $mime->parts();
>> 
>> for my $npart ( 0..$#parts ) {
>>      my $part = $parts[$npart];
>>      my $header = $part->header_obj();
>>      my $htext = $header->as_string();
>>      my $body = $part->body();
>> 
>>      print $header;
>> }
>> 
>> after I ran its from CLI, I got an error message Undefined subroutine 
>> &Email::MIME called at line 13.
>> 
>> what does the error mean?
> 
> That means I mistyped the line. It should be this:
> 
>       my $mime = Email::MIME->new($contents);
> 
> 

Reply via email to