Re: Mail funtion question

From: Date: Wed, 30 Jul 2003 11:19:47 +0000
Subject: Re: Mail funtion question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157505@lists.php.net to get a copy of this message
Thanks for your reply Bobby. I thought I might be able to use the @ to supress the errors. The way you wrote the code below is close to what I am doing, sending the bulk emails one at a time. I didn't see anything like $result= @mail($to, $subject, $msg) in the online PHP documentation. but it looks like it should do the trick. Thanks again. "Bobby Patel" <anup_patel@rogers.com> wrote in message news:20030730033028.97292.qmail@pb1.pair.com... > I haven't worked with PHP mail for a while, but since no one has responded > I'll give you something to consider: > > 1. Why don't you try error suppression , @ ? or you can set error_reporting > down or you can capture all output by using output buffering. > 2. You can trap the invalid email, but it may be *more* complex and result > in a slower script. You will have to evaluate this for yourself, > > $emails = array (); #array of email info > # In the form > # $emails[0] = array (email => > mailto:'abc@abc.com' , name => 'Reciever > Name'); > # $emails[1] = array (email => >mailto:'abc@xyz.com' , name => 'Reciever Name > 2'); > > $invalid_emails = array(); > foreach ($emails as $index => $info){ > > $result = @mail ($info['email'], 'Bulk Newsletter Subject', 'email > messafge') ; > if (!$result) { > $invalid_emails [] = $info['email']; // capture invalid email > } > } > > Please note, that the code above will call mail once for each email, so if > you have 100 emails this will run 100 times, where as if you stacked all the > emails into one mail call. But then you may not be able to find the invalid > emails. > > > > > "Irvin Amoraal" <irvin@cabletv.on.ca> wrote in message > news:20030729214615.15280.qmail@pb1.pair.com... > > I am using the PHP mail() function to send subscribed-to bulk email. It > > successfully sends emails to the valid email addresses, but I get a series > > of error messages at the top of the PHP page like: > > /home/[my folder]/dead.letter... Saved message in > > /home/[my folder]/dead.letter 123... User unknown > > > > I'm almost positive the error msgs are caused by invalid email addresses > > that are stored in the database. > > > > I have two questions: > > 1. How can I suppress the error msg's? @mail....? > > 2. Can the error be trapped and the invalid email address captured to be > > spit out in code? > > > > Thanks for your help. > > > > Irvin. > > > > > >

« previous php.general (#157505) next »