PHPMailer
Code: Select all
$num = 50;
$PHPMAILDIR = "/home/www/msg_intranet/php/phpmail/";
require_once($PHPMAILDIR . "class.phpmailer.php");
$mail = new phpmailer();
$mail->PluginDir = $PHPMAILDIR;
$mail->IsSMTP();
$mail->Host = "localhost";
$mail->SMTPKeepAlive = true;
$mail->SetLanguage("en", $PHPMAILDIR);
$mail->Timeout = 60;
$mail->Encoding = "quoted-printable";
$mail->CharSet = 'us-ascii';
$sender = 'test@domain.com';
$mail->From = $sender;
$mail->Subject = 'Test Subject';
$body = file_get_contents('htmlbody.html');
$altbody = <<<EOT
This is the text body.
EOT;
$mail->IsHTML(true);
$mail->Body = $body;
$mail->AltBody = $altbody;
$mail->Sender = $sender;
$mail->ReturnPath = $sender;
$timein = time();
for ($i=0;$i<$num;$i++) {
$to = "speedtest+$i@domain.com";
$mail->ClearAllRecipients();
$mail->AddAddress($to);
$mail->Send();
}
$timeout = time();
print "Done - ".($timeout-$timein)." seconds\n";
Code: Select all
$num = 50;
$SWIFTMAILDIR = "/home/www/msg_intranet/php/swift/";
require_once($SWIFTMAILDIR . "swift_required.php");
$mailtransport = Swift_SmtpTransport::newInstance('localhost', 25);
$mailer = Swift_Mailer::newInstance($mailtransport);
$sender = 'test@domain.com';
$mail = new Swift_Message();
$mail->setFrom($sender);
$mail->setSubject('Test Subject');
$mail->setCharset('us-ascii');
$body = file_get_contents('htmlbody.html');
$altbody = <<<EOT
This is the text body.
EOT;
$mail->setBody($body, 'text/html');
$mail->addPart($altbody, 'text/plain');
$mail->setSender($sender);
$mail->setReturnPath($sender);
$timein = time();
for ($i=0;$i<$num;$i++) {
$to = "speedtest+$i@domain.com";
$mail->setTo(array($to));
$mailer->send($mail);
}
$timeout = time();
print "Done - ".($timeout-$timein)." seconds\n";
Output from PHPMailer Version:
Done - 10 seconds
Output from Swift Version:
Done - 33 seconds
This is sending 50 emails. Increasing it up to 500 emails changes it to 98 seconds and 331 seconds, so the timing is fairly consistent at a 3.3:1 ratio. I tried tweaking the byte stream (from 4 to 8 then higher to 128+), but it would only drop Swift's speed down to 23 seconds at the minimum.
My question - Is this something that's currently being worked on? For single emails and such, this isn't too much of a big deal, but for newsletters and other larger mailings, this becomes a breaking point. For instance, 10000 messages (at these rates) would be 33 minutes or so with PHPMailer and almost 2 hours with Swift.
I'm going to look further into QPEncoder to see if I can do some other tweaks, but I wanted to first see if anyone else has any ideas first.