[dancer-users] Email + template toolkit

Dan Busarow dan at buildingonline.com
Wed Mar 2 18:32:44 GMT 2016


On 3/2/16 11:00 AM, Hugues wrote:
> Hello
> I'm using Dancer + Dancer::Plugin::Email
> 
> Do you know if it's possible to send a email using template with
> template toolkit ?
> and passe variable to this template ?


Hugues,

Yep. Just capture the output of template into a scalar and pass that to
email.

my $email_body = template "template-file.tt", $variables, { layout =>
undef };

email {
            from => $from,
            to => $to,
            subject => "Your Subject Line",
            body => $email_body,
            type => "html",
        };

Dan
-- 
 Dan Busarow
 BuildingOnline.com
 http://www.BuildingOnline.net/
 888-496-6648 ext 218


More information about the dancer-users mailing list