diff options
author | nornholdj <nornholdj@gmail.com> | 2014-10-31 15:10:06 -0400 |
---|---|---|
committer | nornholdj <nornholdj@gmail.com> | 2014-10-31 15:10:06 -0400 |
commit | 68a7e8ec33f205a71107d924e0d244f5edac97a6 (patch) | |
tree | 7e47e9d41a8a3304e32eb0da6219c523f3e9c126 /examples/transmission/send_transmission_all_fields.php | |
parent | de407ac8bf029e85278eaeb683e6f86c6a11c097 (diff) | |
download | php-sparkpost-68a7e8ec33f205a71107d924e0d244f5edac97a6.zip php-sparkpost-68a7e8ec33f205a71107d924e0d244f5edac97a6.tar.gz php-sparkpost-68a7e8ec33f205a71107d924e0d244f5edac97a6.tar.bz2 |
MA-946 #time 3h 30m Revamped Transmission object to be stateless,
updated tests and examples.
Diffstat (limited to 'examples/transmission/send_transmission_all_fields.php')
-rw-r--r-- | examples/transmission/send_transmission_all_fields.php | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php index 5aec6b8..6064e67 100644 --- a/examples/transmission/send_transmission_all_fields.php +++ b/examples/transmission/send_transmission_all_fields.php @@ -1,45 +1,41 @@ <?php namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); -use SparkPost\SparkPost; +use MessageSystems\SparkPost; +use MessageSystems\Transmission; $key = 'YOURAPIKEY'; -$sdk = new SparkPost(['key'=>$key]); +SparkPost::setConfig(['key'=>$key]); - - -$transmission = $sdk->Transmission([ - "campaign"=>"my-campaign", - "metadata"=>[ - "sample_campaign"=>true, - "type"=>"these are custom fields" - ], - "substitutionData"=>[ - "name"=>"Test Name" - ], - "description"=>"my description", - "return_path"=>"return@example.com", - "replyTo"=>"reply@test.com", - "headers"=>[ - "X-Custom-Header"=>"Sample Custom Header" - ], - "openTracking"=>false, - "clickTracking"=>false, - "from"=>"From Envelope <from@example.com>", - "html"=>"<p>Hello World! Your name is: {{name}}</p>", - "text"=>"Hello World!", - "subject"=>"Example Email: {{name}}", - "recipients"=>[ - [ - "address"=>[ - "email"=>"john.doe@sample.com" - ] - ] - ] -]); - -try { - $results = $transmission->send(); +try{ + $results = Transmission::send([ + "campaign"=>"my-campaign", + "metadata"=>[ + "sample_campaign"=>true, + "type"=>"these are custom fields" + ], + "substitutionData"=>[ + "name"=>"Test Name" + ], + "description"=>"my description", + "replyTo"=>"reply@test.com", + "headers"=>[ + "X-Custom-Header"=>"Sample Custom Header" + ], + "openTracking"=>false, + "clickTracking"=>false, + "from"=>"From Envelope <from@example.com>", + "html"=>"<p>Hello World! Your name is: {{name}}</p>", + "text"=>"Hello World!", + "subject"=>"Example Email: {{name}}", + "recipients"=>[ + [ + "address"=>[ + "email"=>"john.doe@sample.com" + ] + ] + ] + ]); echo 'Congrats you can use your SDK!'; } catch (\Exception $exception) { echo $exception->getMessage(); |