I am using this guide as a reference to set up Sparkpost Mailer in local server for my Laravel app but I am getting this error whenever I try to send a mail. I have also tried to copy using the same exact settings as the guide but I still get the same error.But its working fine for sparkpost sandbox domain.
SparkPostException in SparkPost.php line 103: { "errors": [ { "message": "Invalid domain", "description": "No sending domain specified", "code": "7001" } ] }
My account sending domain status is verified but it shows this above error.
My domain screen shot is:
My email sending function is:
public function sendEmail($to,$subject,$messageBody){
$httpClient = new GuzzleAdapter(new Client());
$sparky = new SparkPost($httpClient['key'=>env('SPARKPOST_SECRET')]);
$sparky->setOptions(['async' => false]);
$promise = $sparky->request('GET', 'metrics/ip-pools', [
'from' => '2014-12-01T09:00',
'to' => '2015-12-01T08:00',
'timezone' => 'America/New_York',
'limit' => '10',
]);
$promise = $sparky->transmissions->post([
'options' => [
'sandbox' => false,
'open_tracking'=> true,
'click_tracking'=> true,
'transactional'=> true,
],
'content' => [
'from' => [
'name' => 'SparkPost Team',
'email' => 'test@dskmail.com',
],
'subject' => $subject,
'html' => $messageBody,
'text' => 'Congratulations, {{name}}!! You just sent your very first mailing!',
],
'substitution_data' => ['name' => 'ashraf'],
'recipients' => [
[
'address' => [
'name' => 'Test',
'email' => $to,
],
],
],
]);
}