PEAR Mail_Queue stops on recipient bad syntax
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 */开发者_如何学C
for($i=1;$i<=$num_mail;$i++){
$mail_queue->sendMailsInQueue($max_amount_mails,MAILQUEUE_START,1);
sleep(2);
}
thanks !!
You should open a bug report in the pear bug tracker.
You really should filter out the invalid email addresses before adding entries to the mail_queue table - probably not the answer you want though!
精彩评论