Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Dev
Catalyst plugin
 

Index | Next | Previous | View Flat


orasnita at gmail

Sep 29, 2008, 11:31 PM


Views: 2019
Permalink
Catalyst plugin

Hi,

I've created a Catalyst plugin and I want to upload it to CPAN. Please tell me if it is well to use it as a plugin, or if the suggested name is right.
(It is my first perl module that I want to upload to CPAN.)

I like to send email from Catalyst apps using
$c->email

but the problem with this approach (or many others) is that it is hard to send emails that are UTF-8 encoded, that have a text and an html part, that have one or more attachments, images inline, because I must know more about MIME types and create each part separately specifying the MIME type, the Content-Type, etc.

So I've made a plugin that uses the module Mail::Builder to create the message and Email::Send to send it.
The suggested name would be Catalyst::Plugin::Mail.

I think it could be a plugin, just as C::P::Email, because I think the most easy would be to use it just as C::P::Email, but if you have other suggestions, please tell me.

The interface of this module should be something like:

in MyApp.pm

__PACKAGE__->config(
'mail' => {
mailer_args => ['SMTP', Host => 'smtp.mymail.com'],
#mailer_args => ['Gmail', username => 'user', password => 'pass'],
#mailer_args => ['Sendmail'],
#... other senders supported by Email::Send
mail_args => {
from => 'me[at]mymail.com',
#from => ['me[at]mymail.com', 'My Real Name'],
#... and other mail fields like To:, Cc:, Subject:, if wanted
},
},
);

in a controller:

$c->mail(
to => 'you[at]yourmail.com',
subject => 'The subject (with UTF-8 chars)',
htmltext => '<h1>Hello</h1> world (also UTF-8 encoded)',
);

or:

$c->mail(
from => ['me[at]mymail.com', 'My Name'],
to => ['you[at]yourmail.com', 'Your Name'],
subject => 'The subject',
plaintext => 'The plain text',
htmltext => 'The HTML text',
attachment => ['file1.pdf', 'file2.pdf'],
image => ['image1.png', 'image2.png'],
);

or:

$c->mail(
more_to => [
'friend1[at]mail.com',
'friend2[at]mail.com',
['friend3[at]mail.com', 'Name of Friend3'],
],
subject => 'The subject',
htmltext => 'The html text',
);

or:

$c->mail(
mailer_args => ['SMTP', Host => 'mail.another.com'],
from => 'me[at]another.com',
to => 'you[at]yourmail.com',
subject => 'The subject',
plaintext => 'Text...',
);

Thank you.

Octavian


_______________________________________________
Catalyst-dev mailing list
Catalyst-dev[at]lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev

Subject User Time
Catalyst plugin orasnita at gmail Sep 29, 2008, 11:31 PM
    Re: Catalyst plugin bogdan at wiz Sep 30, 2008, 1:00 AM
        Re: Catalyst plugin orasnita at gmail Sep 30, 2008, 3:44 AM
            Re: Catalyst plugin dbix-class at trout Sep 30, 2008, 7:23 AM
                Re: Catalyst plugin bogdan at wiz Sep 30, 2008, 7:54 AM
                    Re: Catalyst plugin orasnita at gmail Sep 30, 2008, 9:05 AM
                Re: Catalyst plugin jshirley at gmail Sep 30, 2008, 8:08 AM
    Re: Catalyst plugin bobtfish at bobtfish Sep 30, 2008, 1:38 AM
    Re: Catalyst plugin orasnita at gmail Sep 30, 2008, 10:35 AM
        Re: Catalyst plugin jshirley at gmail Sep 30, 2008, 12:23 PM
    Re: Catalyst plugin dbix-class at trout Sep 30, 2008, 4:44 PM
    Re: Catalyst plugin orasnita at gmail Oct 1, 2008, 12:15 AM
        Re: Catalyst plugin dbix-class at trout Oct 1, 2008, 5:45 PM
            Re: Catalyst plugin jshirley at gmail Oct 1, 2008, 7:18 PM
            Re: Catalyst plugin orasnita at gmail Oct 1, 2008, 11:53 PM
                Re: Catalyst plugin bobtfish at bobtfish Oct 2, 2008, 3:07 AM
    Re: Catalyst plugin orasnita at gmail Oct 1, 2008, 11:45 PM
        Re: Catalyst plugin bobtfish at bobtfish Oct 2, 2008, 3:07 AM
            Re: Catalyst plugin orasnita at gmail Oct 2, 2008, 5:41 AM
                Re: Catalyst plugin bobtfish at bobtfish Oct 2, 2008, 6:18 AM
                    Re: Catalyst plugin orasnita at gmail Oct 2, 2008, 9:35 AM
                        Re: Catalyst plugin bobtfish at bobtfish Oct 2, 2008, 6:08 PM
                Re: Catalyst plugin dbix-class at trout Oct 5, 2008, 3:40 AM
                    Re: Catalyst plugin orasnita at gmail Oct 5, 2008, 4:23 AM
                        Re: Catalyst plugin jshirley at gmail Oct 5, 2008, 8:37 AM
    Re: Catalyst plugin eriam at eriamschaffter Oct 2, 2008, 6:19 AM
    Re: Catalyst plugin orasnita at gmail Oct 2, 2008, 8:44 AM
        Re: Catalyst plugin jshirley at gmail Oct 2, 2008, 9:24 AM
    Re: Catalyst plugin orasnita at gmail Oct 2, 2008, 10:19 AM
    Re: Catalyst plugin dbix-class at trout Oct 5, 2008, 3:42 AM
        Re: Catalyst plugin brunorc at gmail Oct 8, 2008, 11:25 AM
    Re: Catalyst plugin orasnita at gmail Oct 5, 2008, 9:32 AM
        Re: Catalyst plugin jshirley at gmail Oct 5, 2008, 10:18 AM
    Re: Catalyst plugin orasnita at gmail Oct 5, 2008, 12:28 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.