Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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;
Thanks and greetings...
Wijnand Nijs

Re: HTML::Template

Quoted text here. Click to load it


Quoted text here. Click to load it

Yes, the process method can store the output in a scalar as

    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)


Arachnids near Coyolillo - part 1

Site Timeline