summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/bootstrap.php3
-rw-r--r--examples/transmission/configuration_based.php30
-rw-r--r--examples/transmission/get_all_transmissions.php17
-rw-r--r--examples/transmission/get_transmission.php16
-rw-r--r--examples/transmission/rfc822.php25
-rw-r--r--examples/transmission/send_transmission_all_fields.php43
-rw-r--r--examples/transmission/stored_recipients_inline_content.php25
-rw-r--r--examples/transmission/stored_template_send.php26
8 files changed, 185 insertions, 0 deletions
diff --git a/examples/bootstrap.php b/examples/bootstrap.php
new file mode 100644
index 0000000..8a5f839
--- /dev/null
+++ b/examples/bootstrap.php
@@ -0,0 +1,3 @@
+<?php
+ require_once dirname(__FILE__).'/../vendor/autoload.php';
+?> \ No newline at end of file
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