On Fri, 8 Sep 2000, Nicolas MONNET wrote:

> On Thu, 7 Sep 2000, Andrew Dunstan wrote:
> 
> |Could someone please explain to me why everybody seems so intent on
> |having a mod_perl handler fork in order to send mail? Why not just use
> |the very common Net::SMTP package which just talks on an SMTP socket to
> |whatever mailhost you have (localhost or other). There are other
> |packages on CPAN which perhaps have more power, but still don't fork, if
> |that's what you need. Every benchmark I've done (quite a few ;-) shows
> |that this is far faster way of sending mail.
> 
> To answer your question, I have tried some times ago, with one such module
> (not sure if it was this one) and as the documentation was lacking I had
> no clear idea of what was going on and could'nt get it to work properly.

Net::SMTP works perfectly and doesn't lack any documentation. If there is
a bunch of folks who use mod_perl for their guestbook sites it's perfectly
Ok to run sendmail/postfix/whatever program you like... But it just
doesn't scale for the big projects. 

For a simple replacement of sendmail routine with Net::SMTP grab:
http://www.stason.org/works/scripts/mail-lib.pl

Why you see only posts which talk about forking the external
process? Because all those who use Net::SMTP don't have any problems,
therefore they are all quiet :)

> As far as benchmarks are concerned, I'm sending one mail after having
> displayed the page, so it shoul'dnt matter much ...

Yeah, and everytime you get 1M process fired up...

> |My understanding (correct me if I'm wrong) is that in general having a
> |mod_perl handler fork is a Bad Thing (tm).
> 
> Dunno about this; never read anything against it.

A lame excuse :) You know, not knowing the law, doesn't wave away a
responsibility for your deeds... .  Just to tell you that there is
*something* to read against it:
http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess

> |(and of course there is even less danger with funky email addresses
> with |shell metacharacters that way, too)
> 
> I pay attention to that kind of issues; as a matter of fact, the command I
> use is: open(OUTP,'|/path/qmail-inject -H') -- so no variable in the
> shell, and print the recipient in the output.

This issue is explained very well at:
http://perl.apache.org/guide/performance.html#Executing_system_in_the_Right_
No metachars issue anymore.

P.S. I'm not responding to this email in order to flame Nicolas, but to
correct things that otherwise might be assumes as correct for those among
us with less experience. Whatever you see posted on the list should never
be taken for granted since we all make mistakes, even the experts among
us.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org


Reply via email to