diff options
Diffstat (limited to 'examples/transmission/stored_template_send.php')
-rw-r--r-- | examples/transmission/stored_template_send.php | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php index 7a0e784..4d58c70 100644 --- a/examples/transmission/stored_template_send.php +++ b/examples/transmission/stored_template_send.php @@ -1,27 +1,24 @@ <?php namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); -use SparkPost\SparkPost; - - -$key = 'YOURAPIKEY'; -$sdk = new SparkPost(['key'=>$key]); - - - -$transmission = $sdk->Transmission(); - -$transmission->setReturnPath('return@example.com') - ->setFrom('From Envelope <from@example.com>') - ->addRecipient([ - "address"=>[ - "email"=>"john.doe@sample.com" - ] - ]) - ->useStoredTemplate('my-template'); + use MessageSystems\SparkPost; + use MessageSystems\Transmission; + + $key = 'YOURAPIKEY'; + SparkPost::setConfig(['key'=>$key]); try { - $results = $transmission->send(); + $results = Transmission::send([ + "from"=>"From Envelope <from@example.com>", + "recipients"=>[ + [ + "address"=>[ + "email"=>"john.doe@sample.com" + ] + ] + ], + "template"=>"my-template" + ]); echo 'Congrats you can use your SDK!'; } catch (\Exception $exception) { echo $exception->getMessage(); |