$config['api-key']]); try { $results = $sparky->transmission->send([ 'from' => [ 'name' => 'From Envelope', 'email' => 'from@sparkpostbox.com', ], 'html' => '
Hello World!
', 'text' => 'Hello World!', 'subject' => 'Example Email', 'recipients' => [ [ 'address' => [ 'email' => 'john.doe@example.com', ], ], ], ]); echo 'Congrats! You sent an email using SparkPost!'; } catch (\Exception $exception) { echo $exception->getAPIMessage()."\n"; echo $exception->getAPICode()."\n"; echo $exception->getAPIDescription()."\n"; }