Petr Vileta wrote:
> From: "Bowie Bailey"
> > Are any of these other modules faster than Net::SMTP?
> > 
> > I was writing a Perl program that was sending a lot of mail.  I did
> > some performance testing and found that (on Linux), it was faster
> > to shell out and call sendmail than to use Net::SMTP.
> 
> This is normal :-)
> Net::SMTP comunicate with SMTP server via TCP/IP protocol and must
> 1) open communication
> 2) transfer header and data
> 3) wait for accepting
> 
> but using local sendmail use not TCP/IP. Mail header and body from
> your script sendmail get as a standard file (or pipe). Senmail accept
> (or not) this mail, store it into output queue and wait for another.
> After your script commit eg. 1000 mails to sendmail and done, senmail
> continue to work and sending mails from output queue to recipients.

Yes, but it was a bit surprising to find that the overhead for opening
an SMTP connection from Perl is greater than the overhead of spawning a
new process to run sendmail.  Before I did the testing, I always used
the Perl module because I assumed that sending mail from within the
program would be more efficient than spawning a process.

I'm not even dealing with sending multiple emails.

I'm comparing this:
    my $smtp = Net::SMTP->new('localhost');
    $smtp->mail($from);
    $smtp->to($to);
    $smtp->data();
    $smtp->datasend($message);
    $smtp->dataend();
    $smtp->quit;

To this:
    open MAIL, "|sendmail -f $from $to";
    print MAIL $message;
    close MAIL;

-- 
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to