...

View Full Version : php mail validation



o0O0o.o0O0o
05-19-2008, 02:01 AM
hi ,


i am sending mail to group of customers using (php mailer)around 10,000
Now few of the email address are not working now (around 2000)

Now everytime i send group mail , my webhost gets 2000 bounce back mails .
Is there mail sending scripts which first checks if email address is valid or not and then send email

syosoft
05-19-2008, 04:01 AM
My suggestion would be to flag the bounce-backs in the db and just not send to them any more instead of trying to determine if they're valid before sending.

Look into the Bounce-to email header (or named something simliar). Then look to pipe that email address to a php script which reads stdin (to get the full email headers + body) and then have that script flag the db record associated with the to address as "inactive" or "failed" or whatever (just so you don't send them another).

However, to answer your question directly, I'm only aware how to check the email domain for a response and then assume the email address exists... which really isn't a solution. For this, look into getmxrr and code something simlar to..



// Clearly you could do more than this function does - I'm just giving you a little outline.
function valid_email_address($email_address) {
if(trim($email_address) == '' || !strstr($email_address, '@')) :
return false;
endif;

list($username, $domain) = explode('@', $email_address);
return (function_exists('getmxrr') && getmxrr($domain, $mxhost)) || fsockopen($domain, 25, $errno, $errstr, 30);
}


I only do this at registration time to check for a potentially invalid email (if host is no good, clearly email address isn't).

jaap
05-19-2008, 10:10 PM
You could also walk through your list of addresses, checking them for the appropriate format. I posted a function for doing that in an earlier post (http://www.codingforums.com/showpost.php?p=678167&postcount=4). The ones that validate, could be run through syosoft's code in the previous post.

Good luck!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum