Page 1 of 1

smtp email varification

Posted: Tue Sep 01, 2015 12:59 am
by gautamz07
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 ,

Code: Select all

echo $smtp_results;
i get

Code: Select all

Array
on the screen.

Re: smtp email varification

Posted: Tue Sep 01, 2015 7:10 am
by social_experiment

Code: Select all

<?php
var_dump($smtp_results);
?>
what is returned from this

Re: smtp email varification

Posted: Tue Sep 01, 2015 11:15 am
by gautamz07
I don't get anything on the screen ! :(

Re: smtp email varification

Posted: Wed Sep 02, 2015 3:12 am
by social_experiment

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]

Re: smtp email varification

Posted: Fri Sep 04, 2015 8:30 am
by gautamz07
Thanks dude ! that was really helpful !