mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-28 15:56:08 +03:00
Update method's description and fix parameters
This commit is contained in:
parent
3586bd0398
commit
281cb04130
@ -27,13 +27,19 @@ use Psr\Http\Message\ResponseInterface;
|
|||||||
class EmailValidation extends HttpApi
|
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 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 InvalidArgumentException Thrown when local validation returns an error
|
||||||
* @throws HttpClientException Thrown when there's an error on Client side
|
* @throws HttpClientException Thrown when there's an error on Client side
|
||||||
@ -42,14 +48,11 @@ class EmailValidation extends HttpApi
|
|||||||
*
|
*
|
||||||
* @return ValidateResponse|ResponseInterface
|
* @return ValidateResponse|ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function validate(string $address, bool $mailboxVerification = false)
|
public function validate(string $address)
|
||||||
{
|
{
|
||||||
Assert::stringNotEmpty($address);
|
Assert::stringNotEmpty($address);
|
||||||
|
|
||||||
$params = [
|
$params = ['address' => $address];
|
||||||
'address' => $address,
|
|
||||||
'mailbox_verification' => $mailboxVerification,
|
|
||||||
];
|
|
||||||
|
|
||||||
$response = $this->httpGet('/v4/address/validate', $params);
|
$response = $this->httpGet('/v4/address/validate', $params);
|
||||||
|
|
||||||
|
@ -26,10 +26,7 @@ class EmailValidationTest extends TestCase
|
|||||||
|
|
||||||
public function testValidEmail()
|
public function testValidEmail()
|
||||||
{
|
{
|
||||||
$params = [
|
$params = ['address' => 'foo@mailgun.net'];
|
||||||
'address' => 'me@davidgarcia.cat',
|
|
||||||
'mailbox_verification' => true,
|
|
||||||
];
|
|
||||||
|
|
||||||
$api = $this->getApiMock();
|
$api = $this->getApiMock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user