TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Slow SwiftMailer (http://www.talkphp.com/general/6115-slow-swiftmailer.html)

cartaysm 02-03-2012 03:56 PM

Slow SwiftMailer
 
I have swift mailer setup to send two message and plain and HTML. I have followed a lot of different posts and came up with a solution that works. However when I send for example 7k emails only about 500 made it out before the 30sec timeout. So I switched my timeout to 600secs and only about 3k made it out.

I now I can switch my timeout to 0 or 3600sec and it will go through but it doesnt seem like this should take so long.

I use Debian 6.0, Zimbra 7, Postfix, and SwiftMailer

I am using the mailer like this;

/ Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', xx)
->setUsername('xxx')
->setPassword('xxx')
;

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

//Starts the loop to separate the to email addresses everything past here is built for each email
$to1 = explode(", ", $to);
for($i = 0; $i < count($to1); $i++){

// Create a message
$message = Swift_Message::newInstance($subject)
->setFrom(array($from => 'xxx'))
->setTo(array($to1[$i]))
->setBody($plaintxt)
->addPart($htmltxt, 'text/html');

$plaintxt = substr($plaintxt, 0, -$plaindumplength);
$htmltxt = substr($htmltxt, 0, -$dumplength);

$emailcounter += $mailer->send($message);
}

AxelG 02-18-2012 09:37 PM

One solution is to use a javascript.
1- You send 50 emails
2- you send the info to your script that you have sent 50 emails
3- your script does the request for the 50 other
By this way you avoid the maximum execution time

souvenir 08-31-2012 01:50 AM

I can guarantee you a Custom T-Shirts CMS is a bad idea, it is a sure failure because it is so big and could take as long as a year (yes, a year) to complete. I went through Custom Short Sleeve T-Shirts before.


All times are GMT. The time now is 07:44 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0