hbattat / verifyEmail

PHP class that can be easily used to verify an email address and make sure it is valid and does exist on the mail server. For a supported option please visit the site
https://hbattat.com/verifyemail.html
Apache License 2.0
545 stars 170 forks source link

I can't verifier emails of database #18

Closed ssergio-ll closed 7 years ago

ssergio-ll commented 8 years ago

Hello.

I have a problem. I have a data base in mysql with emails. I need verifier this emails with you script. I get the emails in php with mysqli_fetch_array but this don't run with this function. I have tried to show that result of mysli_fetch_array by screen and this show correctly the address.

If i write ane address in code this run correctly, but if i use the funcion not run.

Please, can you help me?

This is my code example:

` require_once('verifyEmail-master/verify.class.php');

$link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx");

$result = mysqli_query($link, "select * from correos limit 0,10");

while( $datos = mysqli_fetch_array($result) ) { $ve = new VE\VerifyEmail($datos[correo], 'myemail@myemail.com');

    if($ve->verify()==true)
    {
        echo "<br> The email $datos[correo] is correct.";
    }
    else
    {
        echo "<br> The email $datos[correo] is not correct.";
    }

}

`

Very thanks.

hbattat commented 8 years ago

Are you sure this returns the right value? $datos[correo]

Check your syntax my friend. http://php.net/manual/en/function.mysql-fetch-array.php

ssergio-ll commented 8 years ago

Yes. I can show the value in screen. This is correct.

ssergio-ll commented 8 years ago

If i use mysqi_fectch_array the values are corrects. I recive this error of your script:

"No suitable MX records found.".

If i write the value of mysli_fetch_array direct on my code this run, but if save the value in a var and later i use in your script, this don't run.

Help?

Thanks.

hbattat commented 8 years ago

Can you also use the debug function to print out debug messages?

print_r($ve->get_debug());
ssergio-ll commented 8 years ago

This said:

bool(false)

Array ( [0] => initialized with Email: emailtoverifier@email.com, Verifier Email: myemailserver@email.com, Port: 25 [1] => Verify function was called. [2] => Finding MX record... [3] => No MX record was found. ) Array ( [errors] => Array ( [0] => Array ( [code] => 100 [message] => No suitable MX records found. )

    )

)

But this only happen if i read the emails of data base. For example, if a write a email in source code in "$ve = new VE\VerifyEmail(emailtoverifier, myemail);" this run, but if i read this same email of database this don't run and i have check and the read of data base is correct.

Thanks.

hbattat commented 8 years ago

What are the actual emails in the debug messages. It seems like the email might have a typo or something that it does not have an MX record. Without the email I probably won't be able to tell you what the issue is.