|
Posted by John Bokma on March 5, 2008, 3:09 pm
Please log in for more thread options
> Hello,
>
> I am using HTML::Template to generate interactive pages for my site. Is
> it possibel to use this module to generate (from plaintext and html
> templates) to the body (as a var $body) of a mail message?
>
> Something like:
>
> # my $Tmpl = HTML::Template->new(filename => 'templates/html.tmpl');
> # $Tmpl->param(
> # BOUNDERY => $boundary,
^
> # DATE => $Date,
> # TITLE => $Title,
> # HTML => $Html,
> # );
> # print $Tmpl->$Body;
Yes, the process method can store the output in a scalar as
follows:
my $body = '';
$tt->process( 'templates/html.tmpl', $vars, $body )
or die 'Template error: ', $tt->error();
and use MIME::Lite to send the email
(also, I wouldn't recommend to start variable names with caps)
--
John
Arachnids near Coyolillo - part 1
http://johnbokma.com/
|