Re: [htmltmpl] Using HT to create HTML Email
Brought to you by:
samtregar
From: Jason P. <ja...@jo...> - 2004-01-07 16:32:34
|
Chris Faust wrote: > Looking at the docs - would the below work? > > my $email_message = HTML::Template->new( filehandle => *FH, > some_loop => \@someloop, > some_val => $someval, > some_if => 1, > ); > > &send_email($email_message); That would certainly work, though I would say this instead: &send_email( $email_message->output ); Since you're sending the e-mail to a controlled (& homogeneous) list of HTML-receivable e-mail clients, you don't have to worry about a corresponding text version. I like to use MIME::Lite to send e-mails. Off the top of my head (iow: not tested), the send_email func would look something like this: sub send_email { my ( $message, $mime ); ( $message ) = @_; $mime = MIME::Lite->new( To => 'dis...@yo...', From => 'mya...@yo...', Subject => 'Your Report', Data => $message ); $mime->send; # Exercise: Error Handling... } Jason |