Skip to content

Instantly share code, notes, and snippets.

@pontikis
Last active August 20, 2018 17:03
Show Gist options
  • Save pontikis/82b63ece1bfde300f4778ad1beecd3bb to your computer and use it in GitHub Desktop.
Save pontikis/82b63ece1bfde300f4778ad1beecd3bb to your computer and use it in GitHub Desktop.
Email validation with Mailgun and php
<?php
/**
* https://documentation.mailgun.com/en/latest/user_manual.html#email-validation.
*/
use Mailgun\Mailgun;
$mgClient = new Mailgun('YOUR_PUBLIC_API_KEY');
$responce = $mgClient->get('address/validate',
[
'address' => '[email protected]',
'mailbox_verification' => true, // or false if you prefer
]
);
$is_valid = $responce->http_response_body->is_valid;
// to view the whole response
echo var_export(get_object_vars($responce), true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment