How to use HTML template as body to an Email?
Thanks all for your valuable suggestions. @Rick below is the error that I got when I tried the code that I mentioned in the first post. [testemail:37988] error @2016-01-26 14:46:09> Route exception: Could not send email can't build entity: no body, and not multipart I am getting a multipart warning because I didn't specify "multipart => 'related'" in email function. I believe, Dancer2 requires "multipart" to be set to "related" when you want to send HTML emails. I might be wrong but that's what I experienced so far. Best, Tushar On Thu, Jan 28, 2016 at 7:00 AM, <dancer-users-request@dancer.pm> wrote:
Send dancer-users mailing list submissions to dancer-users@dancer.pm
To subscribe or unsubscribe via the World Wide Web, visit http://lists.preshweb.co.uk/mailman/listinfo/dancer-users or, via email, send a message with subject or body 'help' to dancer-users-request@dancer.pm
You can reach the person managing the list at dancer-users-owner@dancer.pm
When replying, please edit your Subject line so it is more specific than "Re: Contents of dancer-users digest..."
Today's Topics:
1. Re: (Rick Leir) 2. Re: How to use HTML template as body to an Email? (Kadir Beyazl?)
----------------------------------------------------------------------
Message: 1 Date: Wed, 27 Jan 2016 09:45:56 -0500 From: Rick Leir <richard.leir@canadiana.ca> To: dancer-users@dancer.pm Subject: Re: [dancer-users] How to use HTML template as body to an Email? Message-ID: < CAGitpvZpWJx055P8Q-W9pMet9DYztFp83rMK_OCzg04pSouNMA@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
There were threads on this recently, I posted config, Perl and tt. There are a few gotchas but it is quite do-able. What error do you see?
http://lists.preshweb.co.uk/pipermail/dancer-users/2016-January/005429.html http://lists.preshweb.co.uk/pipermail/dancer-users/2016-January/005448.html cheers -- Rick
I am trying to send an email as HTML using HTML template. Does anybody know that how can I use HTML template (that resides in view directory) as email body? So far I tried the following code but am not able to get it working. It may be not the right way of doing it.
try { email { from => 'abc@xyz.com', to => 'xyz@abc.com', subject => 'test email', body => template 'contactUsEmail.tt', {name => $params->{'name'}, email => $params->email'}, message => $params->{'message'}}, type => 'html' };
participants (1)
-
Tushar Dave