> On Feb 15, 2017, at 9:56 PM, Eko Budiharto <eko.budiha...@gmail.com> wrote:
> 
> Jim,
> I have one a couple more 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, 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.

Please post all questions to the list. There are other people who can answer 
your questions better than I can.

I just parse the text of the email using regular expressions, line by line:

        my @lines = split(/[\n\r]+/,$text);

        for( my $i = 0; $i <= $#lines; $i++ ) {
                my $line = $lines[$i];
                print "$i. $line\n" if $xdebug;
                
                if( $line =~ m{ \A Subject:\ (.*) \z }x ) {
                        $subject = $1;

etc.

You can also try to use the Email::MIME::header method:

        my $from = $mime->header(‘From’):

I haven’t used that, but it might be worth trying. Email::MIME is an extension 
of the Email::Simple class, so you can look at the documentation for that 
module as well. 
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to