Skip to content

Instantly share code, notes, and snippets.

@b-abctech
Created January 2, 2014 09:35
Show Gist options
  • Save b-abctech/8216896 to your computer and use it in GitHub Desktop.
Save b-abctech/8216896 to your computer and use it in GitHub Desktop.
sending mail in text/html with Catalyst::View::Email::Template
# 1. first install module Catalyst::View::Email::Template, Catalyst::View::Email
# 2. create email template view
# 3. in config add these
View::Email::Template:
template_prefix: email
default:
view: HTML
content_type: text/html
# 4. in controller add something like this
=head2 mailshare
send mail controller
=cut
sub mailshare :Path('/mailshare') : Args(0) {
my ( $self, $c ) = @_;
$c->stash->{email} = {
to => 'b@abctech-thailand.com',
from => 'noreply@startsiden.no',
subject => 'subject title',
template => 'mailshare.tt',
};
$c->forward( $c->view('Email::Template') );
$c->response->status(200);
$c->response->body();
}
# 5. add email template file .tt in email folder eg 'email/mailshare.tt'
# 6. set template to use no wrapper [% META no_wrapper = 1 %]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment