0

i'm using PEAR Mail_Queue, everything works great, except when i'm trying to send emails to "bad" recipients (bad syntax like "òla@test.com", "uuu@test,com" , "test@test.com.com")

When the queue finds a bad recipient it just stops, leaving all the others mail in the db queue table...

I just want to make it jump to the next mail, deleting (or not) the bad mail in the queue table...maybe all i need is just some errors handling...

the code i'm using (if you need more code just ask :) ) :

/* How many mails could we send each time the script is called */

$max_amount_mails = 10;
$query=mysql_query("SELECT count(*) FROM mail_queue ORDER by id asc");
$num_tosend= mysql_result($query, 0, 0);
$num_mail=ceil($num_tosend/$max_amount_mails);

/* we use the db_options and mail_options from the config again  */

$mail_queue =& new Mail_Queue($db_options, $mail_options);
$mail_queue->setBufferSize(10);

$contaEmailSpeditesi=0;

/* really sending the messages */
for($i=1;$i<=$num_mail;$i++){
$mail_queue->sendMailsInQueue($max_amount_mails,MAILQUEUE_START,1);

sleep(2);
}

thanks !!

NicolaPasqui
  • 1,112
  • 8
  • 17

2 Answers2

0

You should open a bug report in the pear bug tracker.

cweiske
  • 30,033
  • 14
  • 133
  • 194
0

You really should filter out the invalid email addresses before adding entries to the mail_queue table - probably not the answer you want though!

kguest
  • 3,804
  • 3
  • 29
  • 31
  • yeah, already took care of that, it's just a question about why a (otherwise good) class doesn't work with a common problem like that... – NicolaPasqui Feb 24 '11 at 12:51