The advantage of using sendmail is
[1] a centralised MTA config.
[2] Graceful handling of problems and requeueing of messages if the SMTP
server specified by Net::SMTP would normally be down. eg automatic
resilience based on MX record rerouting can be nice.
Although in a mod_perl situation, I understand the launching of a system
call is not the best thing to do. However, it could be if sendmail itself
is launched to asynchronously handle the posting of the mail while the
cript continues on (if the mail server were otherwise slow for some
reason).
I guess what you use depends on what your circumstances are.
Later,
Gunther
On Tue, 26 Oct 1999, Stas Bekman wrote:
> > Hello, mod_perloids.
> >
> > I'm having a gutfull of trouble sending mail under mod_perl. I'm doing
> > it by the books, to wit, the cookbook and the bigbirdie book, under rh
> > linux 5.2.
> >
> > the code is
> >
> > warn ("MAIL: Opening sendmail... path is \"".$sendmailpath."\"");
> > open (SENDMAIL, $sendmailpath) || warn ("MAIL: Cannot open sendmail
> > at \"".$sendmailpath."\"");
> > print SENDMAIL ( "From: Eidos Web Password Assistant
> > <passwordhelp\@".$dbh->{r}->server->server_hostname.">\n".
> > "To: You <".$dbh->{param}->{csemail}.">\n".
> > "Subject:
> > ".$EidosParser::locale{mailsendpasswordsubject}."\n\n".
> > $EidosParser::locale{mailsendpasswordtext1}.
> > $result[1].
> > $EidosParser::locale{mailsendpasswordtext2}.
> > ($dbh->{r}->server->server_hostname).($dbh->{r}->uri()).
> > $EidosParser::locale{mailsendpasswordtext3}.
> > "\n.\n");
> > warn ("MAIL: Mail Sent okay!");
> > close (SENDMAIL);
> >
> > I ditched the fail-result tests in desperation. :)
> >
> > It tells me the mail has been sent okay (even when the failiure tests
> > were in place) but nothing. Not in the outgoing or incoming mail spools.
> > I tested this code as a vanilla cgi script, and it worked fine. I have
> > *no* idea why it won't work under mod_perl.
> >
> > Anyone else had similar problems (or solutions :),
> > or should I Just Shut Up?
>
> Hmmm, a funny way to ask questions... let me try too: Should we answer the
> question or Just Shut Up? :)
>
> Anyway, how do you know it's a mod_perl problem? How do you know it has
> something to do with mail? Oh, yeah the mail has never reached the
> destination... Did you try to print out what you send instead of piping it
> to sendmail? Check that the generated headers are correct ones...
>
> Other than that, why not to use Net::SMTP, which verifies each command and
> you can arrange your code to die or warn on failure to send some field,
> since it talks directly to the smtp server... take a look at the simple
> send_mail() implemented that way (BTW, it's much faster and lighter than
> sendmail, but this is off-topic...)
> http://www.singlesheaven.com/stas/TULARC/works/scripts/mail-lib.pl
>
> Hope this helps...
>
> _______________________________________________________________________
> Stas Bekman mailto:[EMAIL PROTECTED] www.singlesheaven.com/stas
> Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC
> www.apache.org & www.perl.com == www.modperl.com || perl.apache.org
> single o-> + single o-+ = singlesheaven http://www.singlesheaven.com
>