keiusui has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to write a simple Perl script that loops through all of my e-mails and prints the body of each e-mail to my web browser. Here is what I have so far:
use Mail::POP3Client; $pop = new Mail::POP3Client( USER => "my\@email.address", PASSWORD => "passwordxxxxx", HOST => "mail.mydomain.com" ); for($i = 1; $i <= $pop->Count(); $i++) { $body = $pop->Body($i); print "<p>$body<p><hr>"; }
This code works perfect for plain text e-mails.
However, with html e-mails, the script prints out all sorts of ugly headers. In addition, if the e-mail contains both an html and text version of the body, then the script outputs both the html and text versions (I only need one version, preferably the html version).
Does anyone know of a good way to parse HTML e-mails so that they can be printed out to the web browser?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parsing and printing e-mail
by keszler (Priest) on Dec 17, 2009 at 19:41 UTC | |
by keiusui (Monk) on Dec 17, 2009 at 19:55 UTC | |
by gmargo (Hermit) on Dec 17, 2009 at 23:05 UTC | |
by keiusui (Monk) on Dec 21, 2009 at 05:36 UTC | |
by afoken (Chancellor) on Dec 21, 2009 at 20:24 UTC | |
|
Re: parsing and printing e-mail
by zwon (Abbot) on Dec 17, 2009 at 19:58 UTC |