batchSend or send ?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
spib
Forum Newbie
Posts: 9
Joined: Wed Jul 09, 2003 2:09 am

batchSend or send ?

Post 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
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Re: batchSend or send ?

Post by Oren »

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: batchSend or send ?

Post by Chris Corbyn »

Sounds like you need a call to set_time_limit(0).
Post Reply