NYCPHP Meetup

NYPHP.org

[nycphp-talk] phpmailer + general PHP/email strategies?

robyn o robynover at gmail.com
Mon Apr 17 14:56:21 EDT 2006


Hi list,
I'm working with phpmailer to send email announcements. It's working, but
I'm concerned that maybe it's not working as efficiently as it could be.
I've sent it to a relatively small group of people (about 35) and I don't
see the group getting beyond 100 email addresses for this application.
However, looping through the addresses tends to go slowly -- fine for if I'm
using it myself, but possibly too long to expect other users to wait.

Because each email has information specific to that user, I'm sending
individual emails instead of just adding all the addresses to a Bcc in one
message. So the code is something like this:
---------
$mail = new PHPMailer();
foreach ($recipients as $r){
  bodymsg = "Hi $name";
  $mail->Body = $bodymsg;
  $mail->AddAddress($r);
   if(!$mail->Send()){
      //do something
   } else {
     //etc
  }
  $mail->ClearAddresses(); //clear for next loop
}
---------
Is this a reasonable way to do it? Is there a more efficient way of handling
the code? Or maybe phpmailer is not the right tool.

My other thought is that maybe the actual mailing should happen behind the
scenes, using cron (all the user data is in MySQL) ...


Thanks in advance,
Robyn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060417/9fbaf796/attachment.html>


More information about the talk mailing list