diff options
author | nornholdj <nornholdj@gmail.com> | 2014-11-04 17:42:49 -0500 |
---|---|---|
committer | nornholdj <nornholdj@gmail.com> | 2014-11-04 17:42:49 -0500 |
commit | 39f2699a7e7850397882a6d2ee3a8438a105b72d (patch) | |
tree | ca192a9ea0084b7f59807ff5fd3c262bb05ebb6d /examples/transmission | |
parent | 5d346d241fc0d0b565d7aa6ce0179a5da4c73dc0 (diff) | |
parent | 2a35edc5094276f9a9b1566bdb678386fae14d3d (diff) | |
download | php-sparkpost-39f2699a7e7850397882a6d2ee3a8438a105b72d.zip php-sparkpost-39f2699a7e7850397882a6d2ee3a8438a105b72d.tar.gz php-sparkpost-39f2699a7e7850397882a6d2ee3a8438a105b72d.tar.bz2 |
Merge branch 'feature/MA-946' into develop
Diffstat (limited to 'examples/transmission')
-rw-r--r-- | examples/transmission/configuration_based.php | 30 | ||||
-rw-r--r-- | examples/transmission/get_all_transmissions.php | 17 | ||||
-rw-r--r-- | examples/transmission/get_transmission.php | 16 | ||||
-rw-r--r-- | examples/transmission/rfc822.php | 25 | ||||
-rw-r--r-- | examples/transmission/send_transmission_all_fields.php | 43 | ||||
-rw-r--r-- | examples/transmission/stored_recipients_inline_content.php | 25 | ||||
-rw-r--r-- | examples/transmission/stored_template_send.php | 26 |
7 files changed, 182 insertions, 0 deletions
diff --git a/examples/transmission/configuration_based.php b/examples/transmission/configuration_based.php new file mode 100644 index 0000000..157d3f3 --- /dev/null +++ b/examples/transmission/configuration_based.php @@ -0,0 +1,30 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); + +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +try { + $results = Transmission::send([ + "returnPath"=>"return@example.com", + "from"=>"From Envelope <from@example.com>", + "html"=>"<p>Hello World!</p>", + "text"=>"Hello World!", + "subject"=>"Example Email", + "recipients"=>[ + [ + "address"=>[ + "email"=>"john.doe@example.com" + ] + ] + ] + ]); + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?>
\ No newline at end of file diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php new file mode 100644 index 0000000..754a6fc --- /dev/null +++ b/examples/transmission/get_all_transmissions.php @@ -0,0 +1,17 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); + +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +try { + $results = Transmission::all(); + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?>
\ No newline at end of file diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php new file mode 100644 index 0000000..b85d814 --- /dev/null +++ b/examples/transmission/get_transmission.php @@ -0,0 +1,16 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +try { + $results = Transmission::find('Your Transmission Id'); + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?>
\ No newline at end of file diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php new file mode 100644 index 0000000..1927382 --- /dev/null +++ b/examples/transmission/rfc822.php @@ -0,0 +1,25 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +try { + $results = Transmission::send([ + 'recipients'=>[ + [ + 'address'=>[ + 'email'=>'john.doe@sample.com' + ] + ] + ], + 'rfc822Part'=>"Content-Type: text/plain\nFrom: From Envelope <from@example.com>\nSubject: Example Email\n\nHello World" + ]); + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?>
\ No newline at end of file diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php new file mode 100644 index 0000000..6064e67 --- /dev/null +++ b/examples/transmission/send_transmission_all_fields.php @@ -0,0 +1,43 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +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(); +} +?>
\ No newline at end of file diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php new file mode 100644 index 0000000..f09ca63 --- /dev/null +++ b/examples/transmission/stored_recipients_inline_content.php @@ -0,0 +1,25 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +try { + + $results = Transmission::send([ + "campaign"=>"my-campaign", + "from"=>"From Envelope <from@example.com>", + "html"=>"<p>Hello World! Your name is: {{name}}</p>", + "text"=>"Hello World!", + "subject"=>"Example Email: {{name}}", + "recipientList"=>'Example List' + ]); + + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?>
\ No newline at end of file diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php new file mode 100644 index 0000000..298ba69 --- /dev/null +++ b/examples/transmission/stored_template_send.php @@ -0,0 +1,26 @@ +<?php +namespace Examples\Transmisson; +require_once (dirname(__FILE__).'/../bootstrap.php'); +use MessageSystems\SparkPost; +use MessageSystems\Transmission; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(['key'=>$key]); + +try { + $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(); +} +?>
\ No newline at end of file |