Mailgun\Api\Domain::createCredential PHP Метод

createCredential() публичный Метод

Create a new SMTP credential pair for the specified domain.
public createCredential ( string $domain, string $login, string $password ) : CreateCredentialResponse | array | Psr\Http\Message\ResponseInterface
$domain string Name of the domain.
$login string SMTP Username.
$password string SMTP Password. Length min 5, max 32.
Результат Mailgun\Resource\Api\Domain\CreateCredentialResponse | array | Psr\Http\Message\ResponseInterface
    public function createCredential($domain, $login, $password)
    {
        Assert::stringNotEmpty($domain);
        Assert::stringNotEmpty($login);
        Assert::stringNotEmpty($password);
        Assert::lengthBetween($password, 5, 32, 'SMTP password must be between 5 and 32 characters.');
        $params = ['login' => $login, 'password' => $password];
        $response = $this->httpPost(sprintf('/v3/domains/%s/credentials', $domain), $params);
        return $this->deserializer->deserialize($response, CreateCredentialResponse::class);
    }