summaryrefslogtreecommitdiffstats
path: root/examples/transmission
diff options
context:
space:
mode:
Diffstat (limited to 'examples/transmission')
-rw-r--r--examples/transmission/delete_transmission.php25
-rw-r--r--examples/transmission/get_all_transmissions.php25
-rw-r--r--examples/transmission/get_transmission.php25
-rw-r--r--examples/transmission/rfc822.php34
-rw-r--r--examples/transmission/send_transmission_all_fields.php69
-rw-r--r--examples/transmission/send_with_bcc.php58
-rw-r--r--examples/transmission/send_with_cc.php62
-rw-r--r--examples/transmission/simple_send.php40
-rw-r--r--examples/transmission/stored_recipients_inline_content.php36
-rw-r--r--examples/transmission/stored_template_send.php38
10 files changed, 0 insertions, 412 deletions
diff --git a/examples/transmission/delete_transmission.php b/examples/transmission/delete_transmission.php
deleted file mode 100644
index f7d0530..0000000
--- a/examples/transmission/delete_transmission.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->delete('transmission-id');
- echo 'Transmission deleted!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php
deleted file mode 100644
index c037b2d..0000000
--- a/examples/transmission/get_all_transmissions.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->all();
- echo 'Congrats! You got a list of all your transmissions from SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php
deleted file mode 100644
index 5d59740..0000000
--- a/examples/transmission/get_transmission.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->find('Your Transmission ID');
- echo 'Congrats! You retrieved your transmission from SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php
deleted file mode 100644
index df2b06b..0000000
--- a/examples/transmission/rfc822.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- '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";
-}
diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php
deleted file mode 100644
index 986fd87..0000000
--- a/examples/transmission/send_transmission_all_fields.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key'], 'timeout' => 0]]);
-
-$data = file_get_contents('/path/to/test.csv');
-
-try {
- $results = $sparky->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',
- 'customHeaders' => [
- 'X-Custom-Header' => 'Sample Custom Header',
- ],
- 'trackOpens' => false,
- 'trackClicks' => false,
- 'sandbox' => false,
- 'inlineCss' => true,
- 'transactional' => true,
- 'startTime' => '2016-03-17T08:00:00-04:00',
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World! Your name is: {{name}}</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email: {{name}}',
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- 'attachments' => [
- [
- 'type' => 'text/csv',
- 'name' => 'testing.csv',
- 'data' => base64_encode($data),
- ],
- ],
- ]);
-
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/send_with_bcc.php b/examples/transmission/send_with_bcc.php
deleted file mode 100644
index 7479c4a..0000000
--- a/examples/transmission/send_with_bcc.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/*
- * For a more detailed explanation of how cc/bcc work with SparkPost, please
- * check out this article: https://support.sparkpost.com/customer/portal/articles/1948014
- */
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>An example email using bcc with SparkPost to the {{recipient_type}} recipient.</p>',
- 'text' => 'An example email using bcc with SparkPost to the {{recipient_type}} recipient.',
- 'subject' => 'Example email using bcc',
- 'recipients' => [
- [
- 'address' => [
- 'name' => 'Original Recipient',
- 'email' => 'original.recipient@example.com',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'Original',
- ],
- ],
- [
- 'address' => [
- 'email' => 'bcc.recipient@example.com',
- 'header_to' => '"Original Recipient" <original.recipient@example.com>',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'BCC',
- ],
- ],
- ],
- ]);
- echo 'Congrats! You sent an email with bcc using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/send_with_cc.php b/examples/transmission/send_with_cc.php
deleted file mode 100644
index 7ad2a7b..0000000
--- a/examples/transmission/send_with_cc.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/*
- * For a more detailed explanation of how cc/bcc work with SparkPost, please
- * check out this article: https://support.sparkpost.com/customer/portal/articles/1948014
- */
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>An example email using cc with SparkPost to the {{recipient_type}} recipient.</p>',
- 'text' => 'An example email using cc with SparkPost to the {{recipient_type}} recipient.',
- 'subject' => 'Example email using cc',
- 'recipients' => [
- [
- 'address' => [
- 'name' => 'Original Recipient',
- 'email' => 'original.recipient@example.com',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'Original',
- ],
- ],
- [
- 'address' => [
- 'name' => 'Carbon Copy Recipient',
- 'email' => 'cc.recipient@example.com',
- 'header_to' => '"Original Recipient" <original.recipient@example.com>',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'CC',
- ],
- ],
- ],
- 'customHeaders' => [
- 'CC' => '"Carbon Copy Recipient" <cc.recipient@example.com>',
- ],
- ]);
- echo 'Congrats! You sent an email with cc using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/simple_send.php b/examples/transmission/simple_send.php
deleted file mode 100644
index 6bd0336..0000000
--- a/examples/transmission/simple_send.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World!</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email',
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- ]);
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php
deleted file mode 100644
index 503908b..0000000
--- a/examples/transmission/stored_recipients_inline_content.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'campaign' => 'my-campaign',
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World! Your name is: {{name}}</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email: {{name}}',
- 'recipientList' => 'Example List',
- ]);
-
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php
deleted file mode 100644
index 5ce48e4..0000000
--- a/examples/transmission/stored_template_send.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- 'template' => 'my-first-email',
- ]);
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}