diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-04-23 21:12:54 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-04-23 21:12:54 +0000 |
commit | 3e80abbf531755154b42ca5433f9faa3793cc554 (patch) | |
tree | 0fb99285d3a2d39783b28509eccb2a25fdbfbd04 /Postman/Postman-Mail | |
parent | 152216ed4fd9e7bae72fca87dd1542c1ea5c1196 (diff) | |
download | Post-SMTP-3e80abbf531755154b42ca5433f9faa3793cc554.zip |
* Fix lockfile erros
* Contact form 7 integration
* PHP 5.6 requirement
Diffstat (limited to 'Postman/Postman-Mail')
-rw-r--r-- | Postman/Postman-Mail/PostmanMailgunMailEngine.php | 6 | ||||
-rw-r--r-- | Postman/Postman-Mail/PostmanSendGridMailEngine.php | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Postman/Postman-Mail/PostmanMailgunMailEngine.php b/Postman/Postman-Mail/PostmanMailgunMailEngine.php index 58def41..8258022 100644 --- a/Postman/Postman-Mail/PostmanMailgunMailEngine.php +++ b/Postman/Postman-Mail/PostmanMailgunMailEngine.php @@ -20,7 +20,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { private $apiKey; private $domainName; - private $mandrillMessage; + private $mailgunMessage; /** * @@ -153,7 +153,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { $result = array(); try { if ( $this->logger->isDebug() ) { - $this->logger->debug( 'Creating Mandrill service with apiKey=' . $this->apiKey ); + $this->logger->debug( 'Creating Mailgun service with apiKey=' . $this->apiKey ); } // send the message @@ -184,7 +184,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { private function processSend( $mg ) { - if ( count( $this->mailgunMessage['to'] ) == 1 ) { + if ( count( $this->mailgunMessage['to'] ) <= 1 ) { return $mg->messages()->send( $this->domainName, array_filter( $this->mailgunMessage ) ); } else { diff --git a/Postman/Postman-Mail/PostmanSendGridMailEngine.php b/Postman/Postman-Mail/PostmanSendGridMailEngine.php index 28e3c83..eaa5b69 100644 --- a/Postman/Postman-Mail/PostmanSendGridMailEngine.php +++ b/Postman/Postman-Mail/PostmanSendGridMailEngine.php @@ -188,14 +188,16 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { $response_body = json_decode( $response->body() ); - if ( isset( $response_body->errors[0]->message ) ) { - $this->transcript = $response_body->errors[0]->message; + if ( isset( $response_body->errors[0]->message ) || $response->statusCode() != 200 ) { + + $e = $response->statusCode() != 200 ? sprintf( __( 'ERROR: Status code is %1$s', Postman::TEXT_DOMAIN ), $response->statusCode() ) : $response_body->errors[0]->message; + $this->transcript = $e; $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; $this->transcript .= print_r( $mail, true ); $this->logger->debug( 'Transcript=' . $this->transcript ); - throw new Exception( $response_body->errors[0]->message ); + throw new Exception( $e ); } $this->transcript = print_r( $response->body(), true ); $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; |