Page 1 of 1

batchSend or send ?

Posted: Thu Jan 31, 2008 6:41 am
by spib
Hi,

I'm trying to send approx 50K messages a day using swift mailer and it's working well but I need to improve performance and reliability a little. At present, I am calling a php script every minute using cron which essentially does the following pseudo-code

Code: Select all

 
Fetch email template
Construct message
Fetch x addresses from the database
add each address to recipient list
 
failedaddresses = $swift->batchSend
 
For each address
  if in failedaddress set message failed else set message sent
 
What i'm finding though is that I can only send approx 150 messages per minute before the script times out. However, when it does time out, it may or may not have reached the section of code to update the database and therefore I may get potentially 150 repeated emails.

My question is, would there be much of a performance hit in sending the emails one at a time and updating the db for each address. Is there an optimum way to do this so I don't have to create a new message object each time or whatever?

Thanks

Re: batchSend or send ?

Posted: Thu Jan 31, 2008 11:37 am
by Oren

Re: batchSend or send ?

Posted: Thu Jan 31, 2008 9:13 pm
by Chris Corbyn
Sounds like you need a call to set_time_limit(0).