Re: [Catalyst] Sending email safely with Catalyst
Hi Tatsuhiko! I'm assuming what he says is Don't use mod_perl because it's old, and use FastCGI instead. mod_perl isn't really old, as it still enjoys active development (version 2.04 was released just a couple of days ago). So, I presume there are other arguments against it, even though I don't know much about it: I use FastCGI myself. Michele. -- Michele Beltrame http://www.cattlegrid.info/ ICQ 76660101 - MSN [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Fri, Apr 18, 2008 at 01:31:37PM -0700, Tatsuhiko Miyagawa wrote: On Fri, Apr 18, 2008 at 10:54 AM, Matt S Trout [EMAIL PROTECTED] wrote: But you're writing a new catalyst app, so you're deploying it under fastcgi, right? Really, mod_perl is a legacy deployment option. Don't. ... http://chainsawblues.vox.com/ Your blog is powered by Catalyst running under mod_perl 1.x. Seriously... Thus proving that people who've spent many years wrangling mod_perl 1 can make it run very impressively. I've spent a couple years with MP1 and while I doubt I'm as good as you guys are with it I can make it behave quite well enough for any purpose I've ever needed to. And yet I still deploy everything on FastCGI now, because it's an order of magnitude less fucking about. Draw your own conclusions. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Sat, Apr 12, 2008 at 11:11:41AM +0200, Zbigniew Lukasiak wrote: My first approach was to do the sending in a cron job - but then came the requirement that the emails should be sent as soon as possible. Now I have a forking model, but I don't know if I implemented it correctly (the mod_perl guide recommends against forking http://modperlbook.org/html/10-2-Forking-and-Executing-Subprocessesfrom-mod_perl.html). But you're writing a new catalyst app, so you're deploying it under fastcgi, right? Really, mod_perl is a legacy deployment option. Don't. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Apr 18, 2008, at 10:54 AM, Matt S Trout wrote: On Sat, Apr 12, 2008 at 11:11:41AM +0200, Zbigniew Lukasiak wrote: My first approach was to do the sending in a cron job - but then came the requirement that the emails should be sent as soon as possible. Now I have a forking model, but I don't know if I implemented it correctly (the mod_perl guide recommends against forking http://modperlbook.org/html/10-2-Forking-and-Executing- Subprocessesfrom-mod_perl.html). But you're writing a new catalyst app, so you're deploying it under fastcgi, right? I thought forking from an App wasn't possible with the FastCGI engine. Did something change or did I misread an old thread? I hope so. I'd love to be able to fork in it. Any doc/recipe out there? -Ashley ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On 19 Apr 2008, at 06:31, Tatsuhiko Miyagawa wrote: On Fri, Apr 18, 2008 at 10:54 AM, Matt S Trout dbix- [EMAIL PROTECTED] wrote: But you're writing a new catalyst app, so you're deploying it under fastcgi, right? Really, mod_perl is a legacy deployment option. Don't. ... http://chainsawblues.vox.com/ Your blog is powered by Catalyst running under mod_perl 1.x. Seriously... Is'nt it powered by mod_perl talking to a bunch of perlbal backend processes?I'm guessing that matt is talking about public-facing mod_perl deployments. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Sat, Apr 12, 2008 at 1:06 AM, Dave Rolsky [EMAIL PROTECTED] wrote: On Fri, 11 Apr 2008, Jonathan Rockway wrote: In an ideal world, you should be able to dump the messages into your mail system's queue as quickly as you can dump them into a database table (adding to the mail queue is a disk write, adding to a database is a disk write, unless you've turned off data integrity). I could see how calculating the text of 1 mail messages during a request would be slow, but why would you want to do that? Usually you'll just want to say Your account was created, [% name %]! and queue that. The template rendering and the mail system's queue should be more than fast enough to handle that during a request. As for bulk emails, you probably have a process that calculates those outside of your Catalyst app anyway (running from cron), so calculate them, dump them into the mail queue, and let your mailer daemon figure out what to do. Much better than putting a queue in front of a queue, IMHO. This is UNIX after all. The big problem I've run into when sending lots of emails from a web app (just hundreds, in this case), is that it can be slow enough the browser times out. Presumably you could have a similar problem with a work queue as well. Ultimately, I suspect a solution that forks _immediately_ and then does its thing (whatever that thing may be) is going to be necessary past a certain scale. Then the trick becomes monitoring that forked process. Another solution might be to come up with a way to queue up the job with a single write and do the full email generation via cron. Either way, you have to add complexity to your app if you want to provide feedback on the job status to the user. I'll be working on this soon for an app I'm creating, and I suspect I'll go the route of doing a single insert and processing via a cron job. The upside of this is that for a multi-user app, I won't end up forking a whole bunch of email sending processes and I can exercise some control over the rate that email is generated. My first approach was to do the sending in a cron job - but then came the requirement that the emails should be sent as soon as possible. Now I have a forking model, but I don't know if I implemented it correctly (the mod_perl guide recommends against forking http://modperlbook.org/html/10-2-Forking-and-Executing-Subprocessesfrom-mod_perl.html). I am also contemplating a compromise of sending the first few emails immediately and the rest from a cron job. -dave /*== VegGuide.Org Your guide to all that's veg ==*/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Fri, Apr 11, 2008 at 11:42 AM, Paul Makepeace [EMAIL PROTECTED] wrote: I see there's an Email plugin and wondered if this is enough to send email from a form safely securely or whether something more involved like a port of NMS CGI exists? http://search.cpan.org/~mramberg/Catalyst-Plugin-Email-0.08/Email.pm http://nms-cgi.sourceforge.net/ It's terribly easy to get this wrong so wanted some feedback from people who'd previously implemented something like this live before inadvertently turning my site into a spam conduit :-) I've got a related question - does anyone send bulk emails with that plugin? Is the delay reasonable when sending let's say a hundred emails or do I need a background mechanism for that? I have now a forking solution - but it is a bit complex (and for mod_perl they recommend to do it in a 'cleanup' handler instead of a forked process). -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Sending email safely with Catalyst
I see there's an Email plugin and wondered if this is enough to send email from a form safely securely or whether something more involved like a port of NMS CGI exists? http://search.cpan.org/~mramberg/Catalyst-Plugin-Email-0.08/Email.pm http://nms-cgi.sourceforge.net/ It's terribly easy to get this wrong so wanted some feedback from people who'd previously implemented something like this live before inadvertently turning my site into a spam conduit :-) Thanks, Paul ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On 04/11/2008 04:42 AM, Paul Makepeace wrote: It's terribly easy to get this wrong so wanted some feedback from people who'd previously implemented something like this live before inadvertently turning my site into a spam conduit :-) I use the View::Email instead of the Plugin. I find that the View better fits my architecture philosophy and allows for easy email template management similar to my other HTML view templates. The same kind of security safeguards apply to sending email as for protecting against SQL injection and other taint issues. I don't try sending large numbers of email (see other replies on this thread for suggestions on that). Usually it's a confirmation email for some action the requester has made. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Fri, Apr 11, 2008 at 4:49 PM, J. Shirley [EMAIL PROTECTED] wrote: On Fri, Apr 11, 2008 at 3:51 AM, Zbigniew Lukasiak [EMAIL PROTECTED] wrote: On Fri, Apr 11, 2008 at 11:42 AM, Paul Makepeace [EMAIL PROTECTED] wrote: I see there's an Email plugin and wondered if this is enough to send email from a form safely securely or whether something more involved like a port of NMS CGI exists? http://search.cpan.org/~mramberg/Catalyst-Plugin-Email-0.08/Email.pm http://nms-cgi.sourceforge.net/ It's terribly easy to get this wrong so wanted some feedback from people who'd previously implemented something like this live before inadvertently turning my site into a spam conduit :-) I've got a related question - does anyone send bulk emails with that plugin? Is the delay reasonable when sending let's say a hundred emails or do I need a background mechanism for that? I have now a forking solution - but it is a bit complex (and for mod_perl they recommend to do it in a 'cleanup' handler instead of a forked process). I've been dying to play with http://search.cpan.org/~btrott/Email-Send-TheSchwartz-0.01/lib/Email/Send/TheSchwartz.pm I like TheSchwartz because it's fairly simple, easy to get going and... has this module ready. I'm hoping to have a reason to play with it in the next couple of months. This is interesting - but the documentation unfortunately does not answer following questions: - The worker looks like a polling daemon - how often does it poll the database? Would it be feasible solution on an SQLite database (which does not work very well with many concurrent connections). - How should I run the worker process so that it does not die unexpectedly? Should I put it into inittab or perhaps should I run it in a pair of processes that would fork another one if one of them dies? -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
Hi, On Apr 11, 2008, at 4:15 PM, Zbigniew Lukasiak wrote: On Fri, Apr 11, 2008 at 4:49 PM, J. Shirley [EMAIL PROTECTED] wrote: On Fri, Apr 11, 2008 at 3:51 AM, Zbigniew Lukasiak [EMAIL PROTECTED] wrote: On Fri, Apr 11, 2008 at 11:42 AM, Paul Makepeace [EMAIL PROTECTED] wrote: I see there's an Email plugin and wondered if this is enough to send email from a form safely securely or whether something more involved like a port of NMS CGI exists? http://search.cpan.org/~mramberg/Catalyst-Plugin-Email-0.08/ Email.pm http://nms-cgi.sourceforge.net/ It's terribly easy to get this wrong so wanted some feedback from people who'd previously implemented something like this live before inadvertently turning my site into a spam conduit :-) I've got a related question - does anyone send bulk emails with that plugin? Is the delay reasonable when sending let's say a hundred emails or do I need a background mechanism for that? I have now a forking solution - but it is a bit complex (and for mod_perl they recommend to do it in a 'cleanup' handler instead of a forked process). I've been dying to play with http://search.cpan.org/~btrott/Email-Send-TheSchwartz-0.01/lib/ Email/Send/TheSchwartz.pm I use this exactly to send email. My worker gets the MX of the destination domain and sends the email directly to the remote server. This allows me to react more quickly to invalid email addresses (for those servers that check RCPT TO's). This is interesting - but the documentation unfortunately does not answer following questions: - The worker looks like a polling daemon - how often does it poll the database? Would it be feasible solution on an SQLite database (which does not work very well with many concurrent connections). 5 seconds by default. You can override it in the call to work(). It's documented btw. - How should I run the worker process so that it does not die unexpectedly? Should I put it into inittab or perhaps should I run it in a pair of processes that would fork another one if one of them dies? Some people use daemontools, other initab, or ruinit There are several systems to do that. Alternatively you could just run from cron and use the work_once() call, or the work_until_done(), more difficult to predict the load though. Best regards, -- Pedro Melo Blog: http://www.simplicidade.org/notes/ XMPP ID: [EMAIL PROTECTED] Use XMPP! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
* On Fri, Apr 11 2008, Zbigniew Lukasiak wrote: I've got a related question - does anyone send bulk emails with that plugin? Is the delay reasonable when sending let's say a hundred emails or do I need a background mechanism for that? I have now a forking solution - but it is a bit complex (and for mod_perl they recommend to do it in a 'cleanup' handler instead of a forked process). In an ideal world, you should be able to dump the messages into your mail system's queue as quickly as you can dump them into a database table (adding to the mail queue is a disk write, adding to a database is a disk write, unless you've turned off data integrity). I could see how calculating the text of 1 mail messages during a request would be slow, but why would you want to do that? Usually you'll just want to say Your account was created, [% name %]! and queue that. The template rendering and the mail system's queue should be more than fast enough to handle that during a request. As for bulk emails, you probably have a process that calculates those outside of your Catalyst app anyway (running from cron), so calculate them, dump them into the mail queue, and let your mailer daemon figure out what to do. Much better than putting a queue in front of a queue, IMHO. This is UNIX after all. Regards, Jonathan Rockway -- print just = another = perl = hacker = if $,=$ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On Fri, 11 Apr 2008, Jonathan Rockway wrote: In an ideal world, you should be able to dump the messages into your mail system's queue as quickly as you can dump them into a database table (adding to the mail queue is a disk write, adding to a database is a disk write, unless you've turned off data integrity). I could see how calculating the text of 1 mail messages during a request would be slow, but why would you want to do that? Usually you'll just want to say Your account was created, [% name %]! and queue that. The template rendering and the mail system's queue should be more than fast enough to handle that during a request. As for bulk emails, you probably have a process that calculates those outside of your Catalyst app anyway (running from cron), so calculate them, dump them into the mail queue, and let your mailer daemon figure out what to do. Much better than putting a queue in front of a queue, IMHO. This is UNIX after all. The big problem I've run into when sending lots of emails from a web app (just hundreds, in this case), is that it can be slow enough the browser times out. Presumably you could have a similar problem with a work queue as well. Ultimately, I suspect a solution that forks _immediately_ and then does its thing (whatever that thing may be) is going to be necessary past a certain scale. Then the trick becomes monitoring that forked process. Another solution might be to come up with a way to queue up the job with a single write and do the full email generation via cron. Either way, you have to add complexity to your app if you want to provide feedback on the job status to the user. I'll be working on this soon for an app I'm creating, and I suspect I'll go the route of doing a single insert and processing via a cron job. The upside of this is that for a multi-user app, I won't end up forking a whole bunch of email sending processes and I can exercise some control over the rate that email is generated. -dave /*== VegGuide.Org Your guide to all that's veg ==*/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/