Usage example – Download
Posted by php-manual on Jan 26, 2009 in |
Please remove .txt extension from filename after downloading
Please remove .txt extension from filename after downloading
Copyright © 2012 PHP, Web and IT stuff All rights reserved. PHP Web development in London.
Download above file or see code below
< ?php
// the email to validate
$email = 'joe@gmail.com';
// an optional sender
$sender = 'user@example.com';
// instantiate the class
$SMTP_Valid = new SMTP_validateEmail();
// do the validation
$result = $SMTP_Valid->validate($email, $sender);
// view results
var_dump($result);
echo $email.' is '.($result ? 'valid' : 'invalid')."\n";
// send email?
if ($result) {
//mail(...);
}
?>
Cannot re-assign $this in C:\Program Files\xampp\php\pear\Net\DNS\RR.php
Thanks for file and the php attachment
Warning: Invalid argument supplied for foreach() on line: 90
When validating one email, like the example, not only does it fail but you get a PHP warning.
You have to explode the emails first to get this to work properly.
In the class, on line 120 put this:
$emails = explode(‘,’,$emails);
You can edit the separator to ; or whatever you like.
Hope this helps
Iam checking email Address is valid or not ..
it works on gmail,but yahoo,reddif mails not checking
i have occured error:Error: h.mx.mail.yahoo.com said: 553 Mail from 124.123.190.226 not allowed – 5.7.1 [BL21] Connections not accepted from IP addresses on Spamhaus PBL; see postmaster.yahoo.com/errors/550-bl21.html [550]
please give reply
thanking you
@srinu.galla
It looks like your IP address is blacklisted for some reason. Please remove it from the Spamhaus blacklist and try again.
Yeah!!!
2 corrections needed:
1.) as mentioned above, insert the following after line 119 in smtpvalidateclass.php:
$emails = explode(‘,’,$emails);
2.) displaying the result must be like this:
echo $email.’ is ‘.($result[$email] ? ‘valid’ : ‘invalid’).”";
Now works well for me!
) THANKS!!
thnks for this awesome example it helps me alot
please give me Net/DNS.php page download
The following always returned an empty string (”):
preg_match(‘/^([0-9]{3}) /ims’, $reply, $matches);
$code = isset($matches[1]) ? $matches[1] : ”;
So I changed it to something much simpler and more accurate:
$rlt = explode(” “,$reply);
$code = $rlt[0];
$reply is in the format of
I exploded on the space and took the first element which is the status code.
Thanks, man, very useful article!
Net/DNS.php – it’s part of pear package, you can get it here: download.pear.php.net/package/Net_DNS-1.0.7.tgz or here: pear.php.net/package/Net_DNS/download (if previous link is outdated)