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 ? thanks Hugues.
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
On 03/02/2016 07:00 PM, 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 ? thanks Hugues.
You can simply assign the output of the template call to a variable and use that in the email call, e.g.: https://github.com/interchange/Perl-Dancer-Conference/blob/master/lib/PerlDa... Regards Racke -- Perl and Dancer Development
Thanks Racke and Dan this is exactly what I'm looking for bye Hugues. Le 02/03/2016 19:34, Stefan Hornburg (Racke) a écrit :
On 03/02/2016 07:00 PM, 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 ? thanks Hugues. You can simply assign the output of the template call to a variable and use that in the email call, e.g.:
https://github.com/interchange/Perl-Dancer-Conference/blob/master/lib/PerlDa...
Regards Racke
participants (3)
-
Dan Busarow -
Hugues -
Stefan Hornburg (Racke)