From 7ad4c8255d653aba6d1afbd5966382df468a990b Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Mon, 7 Aug 2017 11:48:16 +0300 Subject: [PATCH 1/8] update composer.json updating to match Send API v3.1 configuration --- appengine/standard/mailjet/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appengine/standard/mailjet/composer.json b/appengine/standard/mailjet/composer.json index f53d7ac15c..95ba347e7f 100644 --- a/appengine/standard/mailjet/composer.json +++ b/appengine/standard/mailjet/composer.json @@ -1,7 +1,7 @@ { "require": { "silex/silex": "^1.3", - "mailjet/mailjet-apiv3-php": "^1.1", + "mailjet/mailjet-apiv3-php": "^1.2", "guzzlehttp/guzzle": "~6.1.0" }, "require-dev": { From ee14def944d0f81357077f58c62a39ed1cccfa02 Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Mon, 7 Aug 2017 11:51:49 +0300 Subject: [PATCH 2/8] update app.php updating to match Send API v3.1 config --- appengine/standard/mailjet/app.php | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/appengine/standard/mailjet/app.php b/appengine/standard/mailjet/app.php index fc5b3d9c58..d8f3e7d3b5 100644 --- a/appengine/standard/mailjet/app.php +++ b/appengine/standard/mailjet/app.php @@ -40,23 +40,27 @@ /** @var Mailjet\Client $mailjet */ $mailjet = $app['mailjet']; $recipient = $request->get('recipient'); - # [START send_email] $body = [ - 'FromEmail' => "test@example.com", - 'FromName' => "Testing Mailjet", - 'Subject' => "Your email flight plan!", - 'Text-part' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", - 'Html-part' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!", - 'Recipients' => [ - [ - 'Email' => $recipient, - ] + 'Messages' => [ + [ + 'From' => [ + 'Email' => "pilot@mailjet.com", + 'Name' => "Mailjet Pilot" + ], + 'To' => [ + [ + 'Email' => $recipient + ] + ], + 'Subject' => "Your email flight plan!", + 'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", + 'HTMLPart' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" ] - ]; - + ] +]; // trigger the API call - $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body]); + $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3']); if ($response->success()) { // if the call succed, data will go here return sprintf( @@ -64,7 +68,6 @@ json_encode($response->getData(), JSON_PRETTY_PRINT) ); } - return 'Error: ' . print_r($response->getStatus(), true); # [END send_email] }); From dce73618d5518dcec02e5b988c4e75b5441ced38 Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Mon, 7 Aug 2017 11:55:30 +0300 Subject: [PATCH 3/8] update composer.json updating to match Send API v3.1 config --- appengine/flexible/mailjet/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appengine/flexible/mailjet/composer.json b/appengine/flexible/mailjet/composer.json index f53d7ac15c..95ba347e7f 100644 --- a/appengine/flexible/mailjet/composer.json +++ b/appengine/flexible/mailjet/composer.json @@ -1,7 +1,7 @@ { "require": { "silex/silex": "^1.3", - "mailjet/mailjet-apiv3-php": "^1.1", + "mailjet/mailjet-apiv3-php": "^1.2", "guzzlehttp/guzzle": "~6.1.0" }, "require-dev": { From 642e957f8e5251465e873475623e5ce829024943 Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Mon, 7 Aug 2017 11:56:47 +0300 Subject: [PATCH 4/8] update app.php updated to match Send API v3.1 config --- appengine/flexible/mailjet/app.php | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/appengine/flexible/mailjet/app.php b/appengine/flexible/mailjet/app.php index fc5b3d9c58..d8f3e7d3b5 100644 --- a/appengine/flexible/mailjet/app.php +++ b/appengine/flexible/mailjet/app.php @@ -40,23 +40,27 @@ /** @var Mailjet\Client $mailjet */ $mailjet = $app['mailjet']; $recipient = $request->get('recipient'); - # [START send_email] $body = [ - 'FromEmail' => "test@example.com", - 'FromName' => "Testing Mailjet", - 'Subject' => "Your email flight plan!", - 'Text-part' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", - 'Html-part' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!", - 'Recipients' => [ - [ - 'Email' => $recipient, - ] + 'Messages' => [ + [ + 'From' => [ + 'Email' => "pilot@mailjet.com", + 'Name' => "Mailjet Pilot" + ], + 'To' => [ + [ + 'Email' => $recipient + ] + ], + 'Subject' => "Your email flight plan!", + 'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", + 'HTMLPart' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" ] - ]; - + ] +]; // trigger the API call - $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body]); + $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3']); if ($response->success()) { // if the call succed, data will go here return sprintf( @@ -64,7 +68,6 @@ json_encode($response->getData(), JSON_PRETTY_PRINT) ); } - return 'Error: ' . print_r($response->getStatus(), true); # [END send_email] }); From ccd392d1d756bd321738c004e780b2b995c1a275 Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Mon, 21 Aug 2017 10:55:10 +0300 Subject: [PATCH 5/8] updating indent --- appengine/flexible/mailjet/app.php | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/appengine/flexible/mailjet/app.php b/appengine/flexible/mailjet/app.php index d8f3e7d3b5..9e631df683 100644 --- a/appengine/flexible/mailjet/app.php +++ b/appengine/flexible/mailjet/app.php @@ -42,23 +42,23 @@ $recipient = $request->get('recipient'); # [START send_email] $body = [ - 'Messages' => [ - [ - 'From' => [ - 'Email' => "pilot@mailjet.com", - 'Name' => "Mailjet Pilot" - ], - 'To' => [ - [ - 'Email' => $recipient - ] - ], - 'Subject' => "Your email flight plan!", - 'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", - 'HTMLPart' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" + 'Messages' => [ + [ + 'From' => [ + 'Email' => "pilot@mailjet.com", + 'Name' => "Mailjet Pilot" + ], + 'To' => [ + [ + 'Email' => $recipient + ] + ], + 'Subject' => "Your email flight plan!", + 'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", + 'HTMLPart' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" + ] ] - ] -]; + ]; // trigger the API call $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3']); if ($response->success()) { From 4651b0652757fbe2613b0cd24c2adafcd856112d Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Mon, 21 Aug 2017 10:56:08 +0300 Subject: [PATCH 6/8] updating indentation --- appengine/standard/mailjet/app.php | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/appengine/standard/mailjet/app.php b/appengine/standard/mailjet/app.php index d8f3e7d3b5..9e631df683 100644 --- a/appengine/standard/mailjet/app.php +++ b/appengine/standard/mailjet/app.php @@ -42,23 +42,23 @@ $recipient = $request->get('recipient'); # [START send_email] $body = [ - 'Messages' => [ - [ - 'From' => [ - 'Email' => "pilot@mailjet.com", - 'Name' => "Mailjet Pilot" - ], - 'To' => [ - [ - 'Email' => $recipient - ] - ], - 'Subject' => "Your email flight plan!", - 'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", - 'HTMLPart' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" + 'Messages' => [ + [ + 'From' => [ + 'Email' => "pilot@mailjet.com", + 'Name' => "Mailjet Pilot" + ], + 'To' => [ + [ + 'Email' => $recipient + ] + ], + 'Subject' => "Your email flight plan!", + 'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!", + 'HTMLPart' => "

Dear passenger, welcome to Mailjet!


May the delivery force be with you!" + ] ] - ] -]; + ]; // trigger the API call $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3']); if ($response->success()) { From babb9b214a13cc68354591f75a76c06a8147466e Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Fri, 25 Aug 2017 11:18:49 +0300 Subject: [PATCH 7/8] updating version call to 3.1 --- appengine/flexible/mailjet/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appengine/flexible/mailjet/app.php b/appengine/flexible/mailjet/app.php index 9e631df683..12ebd2a900 100644 --- a/appengine/flexible/mailjet/app.php +++ b/appengine/flexible/mailjet/app.php @@ -60,7 +60,7 @@ ] ]; // trigger the API call - $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3']); + $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3.1']); if ($response->success()) { // if the call succed, data will go here return sprintf( From ecfce5c97440e35f958f9f9d00d7e8433a6743e4 Mon Sep 17 00:00:00 2001 From: Atanas Damyanliev Date: Fri, 25 Aug 2017 11:19:11 +0300 Subject: [PATCH 8/8] updating version call to 3.1 --- appengine/standard/mailjet/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appengine/standard/mailjet/app.php b/appengine/standard/mailjet/app.php index 9e631df683..12ebd2a900 100644 --- a/appengine/standard/mailjet/app.php +++ b/appengine/standard/mailjet/app.php @@ -60,7 +60,7 @@ ] ]; // trigger the API call - $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3']); + $response = $mailjet->post(Mailjet\Resources::$Email, ['body' => $body], ['version' => 'v3.1']); if ($response->success()) { // if the call succed, data will go here return sprintf(