PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
gautamz07
Forum Contributor
Posts: 331 Joined: Wed May 14, 2014 12:18 pm
Post
by gautamz07 » Tue Sep 01, 2015 12:59 am
Hey guys , i am using this library here
https://github.com/zytzagoo/smtp-validate-email to validate , is the email address provided really exists.
so i basically have created a index.php page with the following code:
<?php
Code: Select all
require('smtp-validate-email.php');
$from = 'a-happy-camper@campspot.net'; // for SMTP FROM:<> command
$email = 'someone@somewhere.net';
$validator = new SMTP_Validate_Email($email, $from);
$smtp_results = $validator->validate();
var_dump($smtp_results);
my question is, how do i echo to the screen to see if the email address is valid or not . if i do ,
i get
on the screen.
social_experiment
DevNet Master
Posts: 2793 Joined: Sun Feb 15, 2009 11:08 am
Location: .za
Post
by social_experiment » Tue Sep 01, 2015 7:10 am
what is returned from this
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
gautamz07
Forum Contributor
Posts: 331 Joined: Wed May 14, 2014 12:18 pm
Post
by gautamz07 » Tue Sep 01, 2015 11:15 am
I don't get anything on the screen !
social_experiment
DevNet Master
Posts: 2793 Joined: Sun Feb 15, 2009 11:08 am
Location: .za
Post
by social_experiment » Wed Sep 02, 2015 3:12 am
Code: Select all
<?php
try {
$validator = new SMTP_Validate_Email($email, $from);
$smtp_results = $validator->validate();
var_dump($smtp_results);
}
catch (Exception $e) {
echo $e->getMessage();
}
?>
returns this:
[text]
array(2) { ["
someone@somewhere.net "]=> bool(false) ["domains"]=> array(1) { ["somewhere.net"]=> array(2) { ["users"]=> array(1) { [0]=> string(7) "someone" } ["mxs"]=> array(1) { ["somewhere.net"]=> int(0) } } } }
[/text]
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
gautamz07
Forum Contributor
Posts: 331 Joined: Wed May 14, 2014 12:18 pm
Post
by gautamz07 » Fri Sep 04, 2015 8:30 am
Thanks dude ! that was really helpful !