From: "ivorw" <[EMAIL PROTECTED]>
>I know there's more than one way to do this. I'm looking at what the
> best practice is.
>
> I've had some success inthe past with Catalyst::Plugin::Email, but I'm
> now looking at Catalyst::View::Email[::Template] which seems altogether
> much cleaner, able to be controlled from the config.
>
A more cleaner and better solution is to use Mail::Sender::Easy.
You can create UTF-8 encoded messages, include attachments, inline images,
create messages with a text and an html part, and if you use MIME::Words you
can also use special chars in To, From and Subject fields or other headers.
You can do:
use Mail::Sender::Easy qw(email);
use MIME::Words qw(:all);
email({
fromaddr => '[EMAIL PROTECTED]',
from => 'My Name <[EMAIL PROTECTED]>',
toaddr => '[EMAIL PROTECTED]',
to => encode_mimewords('Your Name with special chars <[EMAIL PROTECTED]>',
Charset => "UTF-8"),
subject => 'The subject',
smtp => '127.0.0.1',
#auth => 'LOGIN',
#authid => "user",
#authpwd => "password",
#skip_bad_recipients => 1,
_text => 'The text body',
_html => 'The <b>html</b> body',
_text_info => {charset => "UTF-8"},
_html_info => {charset => "UTF-8"},
#priority => 2, # 1-5 high to low
#confirm => 'delivery, reading',
_attachments => {
'smiley.gif' => {
_disptype => 'GIF Image',
_inline => 'smile1',
description => 'Smiley',
ctype => 'image/gif',
file => '/home/foo/images/smiley.gif',
},
'mydata.pdf' => {
description => 'Data Sheet',
ctype => 'application/pdf',
msg => 'message',
},
},
}) or die $@;
It would be also nice a Catalyst::Plugin::Mail or Catalyst::View::Mail that
uses Mail::Sender::Easy and MIME::Words, but using those modules directly is
very easy and doesn't require writing much code anyway.
And of course, Mail::Sender::Easy offers much many options than those shown.
Octavian
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/