From 281cb0413098fae22b5ab3676954448630b8ea62 Mon Sep 17 00:00:00 2001 From: David Garcia Date: Fri, 9 Aug 2019 23:56:36 +0100 Subject: [PATCH] Update method's description and fix parameters --- src/Api/EmailValidation.php | 21 ++++++++++++--------- tests/Api/EmailValidationTest.php | 5 +---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Api/EmailValidation.php b/src/Api/EmailValidation.php index bcb6a2d..69c44d2 100644 --- a/src/Api/EmailValidation.php +++ b/src/Api/EmailValidation.php @@ -27,13 +27,19 @@ use Psr\Http\Message\ResponseInterface; class EmailValidation extends HttpApi { /** - * Addresses are validated based off defined checks. + * Mailgun API will validate the given address based on: + * - Mailbox detection + * - Syntax checks (RFC defined grammar) + * - DNS validation + * - Spell checks + * - Email Service Provider (ESP) specific local-part grammar (if available). * - * This operation is only accessible with the private API key and not subject to the daily usage limits. + * Pricing details for Mailgun’s email validation service can be found on Mailgun's pricing page. + * + * @see https://documentation.mailgun.com/en/latest/api-email-validation.html + * @see https://www.mailgun.com/pricing * * @param string $address An email address to validate. Maximum: 512 characters. - * @param bool $mailboxVerification If set to true, a mailbox verification check will be performed - * against the address. The default is False. * * @throws InvalidArgumentException Thrown when local validation returns an error * @throws HttpClientException Thrown when there's an error on Client side @@ -42,14 +48,11 @@ class EmailValidation extends HttpApi * * @return ValidateResponse|ResponseInterface */ - public function validate(string $address, bool $mailboxVerification = false) + public function validate(string $address) { Assert::stringNotEmpty($address); - $params = [ - 'address' => $address, - 'mailbox_verification' => $mailboxVerification, - ]; + $params = ['address' => $address]; $response = $this->httpGet('/v4/address/validate', $params); diff --git a/tests/Api/EmailValidationTest.php b/tests/Api/EmailValidationTest.php index d6fb37b..0abba75 100644 --- a/tests/Api/EmailValidationTest.php +++ b/tests/Api/EmailValidationTest.php @@ -26,10 +26,7 @@ class EmailValidationTest extends TestCase public function testValidEmail() { - $params = [ - 'address' => 'me@davidgarcia.cat', - 'mailbox_verification' => true, - ]; + $params = ['address' => 'foo@mailgun.net']; $api = $this->getApiMock();