Usage example – Download

Posted by php-manual on Jan 26, 2009 in Miscellaneous |

Usage example - Download

Please remove .txt extension from filename after downloading

4 Comments

php-manual
Feb 11, 2009 at 12:47 pm

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(...);
}

?>


 
Nsthinh
Jun 24, 2009 at 9:20 am

Cannot re-assign $this in C:\Program Files\xampp\php\pear\Net\DNS\RR.php


 
Kaiser
Sep 4, 2009 at 4:16 am

Thanks for file and the php attachment


 
Jeremy
Jan 15, 2010 at 7:27 pm

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


 

Reply

Copyright © 2010 PHP, Web and IT stuff All rights reserved. PHP Web development in London.