in reply to Is there any way to send HTML table information
I have a html page (which is dynamically generated by a perl program),
Before worrying about how to convert the table on a page to an e-mailable format, have you considered modifying the generator to make your life easier?
If you store the results in a CSV file (check out File::Temp for one good method of making sure the name is unique, and Text::CSV_XS for making the CSV file) right before you send the HTML table out, then reference the file name in the HTML form (as a hidden element), you can have the mail-sending program attach said file to the message (check out MIME::Lite for that). Once you're there, you could even add the option to download said CSV file instead of having it mailed.
Since CSV files will typically open in a spreadsheet application on the users' computer (if the user is savvy enough to change that, they probably know how to deal with CSVs anyhow), it makes for a pretty nice interface.
What you don't want to do is e-mail the HTML verbatim; as others have pointed out, it will often be filtered away and/or irritate the recipient.
If you really can't modify the program that builds the page to start with, you could use LWP from your mailing program to retrieve the page, and something like HTML::TokeParser to get the data back into a Perl data structure. Then, either write out a text-only table (see format and write, or just use Text::Table), or generate and attach a CSV as above.
Just be sure of your real requirements before pursuing things too far.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is there any way to send HTML table information
by Anonymous Monk on Mar 15, 2007 at 11:21 UTC |