zytzagoo / smtp-validate-email

A PHP library for performing email addresses validation via SMTP
GNU General Public License v3.0
437 stars 155 forks source link

Store SMTP response code in validation results (pull request) #85

Open strein opened 3 weeks ago

strein commented 3 weeks ago

Hi,

thank you for your great work!

I've added the option to store the SMTP result code for email addresses that fail validation.

They'll be stored in a new sub-array in the validate() results array like this:

[smtpErrors] => Array
        (
            [foobar_unknown@gmail.com] => Array
                (
                    [code] => 550
                    [message] => 550-5.1.1 The email account that you tried to reach does not exist. Please try

                )

        )

Feel free to check out my code in the feature/return-smtp-response-code branch of https://github.com/strein/smtp-validate-email.git and let me know if you want me to file a pull request.