Closed markovic-nikola closed 3 years ago
Hi @markovic-nikola,
Thank you for your PR, it looks good.
Could you add a new helper function in helpers.php
to quickly access the new method like below and update README for documentation.
if (!function_exists('sparkpost_check_email')) {
function sparkpost_check_email($email): JsonResponse
{
Validator::make(['email' => $email], [
'email' => [
'required', 'email'
]
])->validate();
$config = config('services.sparkpost', []);
$sparkpostOptions = $config['options'] ?? [];
$guzzleOptions = $config['guzzle'] ?? [];
$client = app()->make(Client::class, $guzzleOptions);
return (new SparkPostTransport($client, $config['secret'], $sparkpostOptions))->validateSingleRecipient($email);
}
}
Then I can accept the PR and tag a new version. Thanks in advance
Hi @eldor,
Thanks for the fast response, I updated the code as you requested.
Regarding the SparkPostTransport
class initialization for helper functions, in my projects I did it a little bit differently, not sure if it's better though
return app('mailer')->getSwiftMailer()->getTransport()->validateSingleRecipient($email);
Although both approaches seem to work fine.
PR is merged, thank you for the contribution.
Hello,
First of all, thank you for maintaining and keeping this package alive.
Recently I was in need of SparkPost API email validation service so I thought it would be convenient to extend the existing driver with this functionality in case someone else needs it in the future. And since it's not too complex change/addition I hope it won't be too much work for you to merge it.
Best regards, Nikola