diff options
Diffstat (limited to 'examples/transmission/rfc822.php')
-rw-r--r-- | examples/transmission/rfc822.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php index 5ec5aef..df2b06b 100644 --- a/examples/transmission/rfc822.php +++ b/examples/transmission/rfc822.php @@ -1,9 +1,11 @@ <?php + namespace Examples\Transmisson; -require_once (dirname(__FILE__).'/../bootstrap.php'); + +require_once dirname(__FILE__).'/../bootstrap.php'; //pull in API key config -$configFile = file_get_contents(dirname(__FILE__) . '/../example-config.json'); +$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json'); $config = json_decode($configFile, true); use SparkPost\SparkPost; @@ -11,23 +13,22 @@ use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); +$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]); try { $results = $sparky->transmission->send([ - 'recipients'=>[ + 'recipients' => [ [ - 'address'=>[ - 'email'=>'john.doe@example.com' - ] - ] + 'address' => [ + 'email' => 'john.doe@example.com', + ], + ], ], - 'rfc822'=>"Content-Type: text/plain\nFrom: From Envelope <from@sparkpostbox.com>\nSubject: Example Email\n\nHello World" + 'rfc822' => "Content-Type: text/plain\nFrom: From Envelope <from@sparkpostbox.com>\nSubject: Example Email\n\nHello World", ]); echo 'Congrats! You sent an email using SparkPost!'; } catch (\Exception $exception) { - echo $exception->getAPIMessage() . "\n"; - echo $exception->getAPICode() . "\n"; - echo $exception->getAPIDescription() . "\n"; + echo $exception->getAPIMessage()."\n"; + echo $exception->getAPICode()."\n"; + echo $exception->getAPIDescription()."\n"; } -?> |