There is a very important reason for having to fork qmail-inject. Qmail
by default will not allow mail relaying as a good security measure. You
don't want your mail server to be used for spamming especially if you
have a T3 or a T1 link. Anyone who is allowing sendmail to relay is in
for trouble - there has been occassions when people have been sued just
because the spamming originated from their servers.

You cant use Net::SMTP because when you try to send out emails to other
domains by connecting to the localhost Qmail will reject it because the
reciepient is not defined as a local user or a virtual domain.

In anycase when one writes a email and sends it the email client doesnt
go and deliver it to the SMTP port (atleast if they are on the same
server). Rather the email client executes the MDA and allows it to
handle the situation appripriately. In case of qmail it is
/var/qmail/bin/qmail-inject.

I personally don't like forking from modperl but that doesn't imply
calling qmail-inject is a wrong approach either. I am sure their are
work arounds for most situation but sending a email with users
submission is a very quick and dirty solution if you are hard pressed
for time.



Mithun

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.
> 
> My understanding (correct me if I'm wrong) is that in general having a mod_perl 
>handler fork is a Bad Thing (tm).
> 
> (and of course there is even less danger with funky email addresses with shell 
>metacharacters that way, too)
> 
> I recall with some fondness Randal's "useless use of cat" awards - maybe we need to 
>create a "useless use of fork" award :-)
> 
> cheers
> 
> andrew

Reply via email to