summaryrefslogtreecommitdiff
path: root/Postman/Postman-Mail/PostmanMailgunMailEngine.php
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-08-07 21:16:19 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-08-07 21:16:19 +0000
commit5cb7d912a0b18a8d4b41153c75c8084ae35b84b6 (patch)
tree65dc7013b4e1c981e8e5620ae6093bc494d03b3d /Postman/Postman-Mail/PostmanMailgunMailEngine.php
parent9983c9755ee33e56a7f16ab3896eea3406e56619 (diff)
downloadPost-SMTP-5cb7d912a0b18a8d4b41153c75c8084ae35b84b6.zip
Support for Mailgun Europe Region
Diffstat (limited to 'Postman/Postman-Mail/PostmanMailgunMailEngine.php')
-rw-r--r--Postman/Postman-Mail/PostmanMailgunMailEngine.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/Postman/Postman-Mail/PostmanMailgunMailEngine.php b/Postman/Postman-Mail/PostmanMailgunMailEngine.php
index 8258022..e874704 100644
--- a/Postman/Postman-Mail/PostmanMailgunMailEngine.php
+++ b/Postman/Postman-Mail/PostmanMailgunMailEngine.php
@@ -1,6 +1,8 @@
<?php
require_once 'mailgun/mailgun.php';
+
use Mailgun\Mailgun;
+use Mailgun\HttpClientConfigurator;
if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
@@ -18,6 +20,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
// the result
private $transcript;
+ private $api_endpoint;
private $apiKey;
private $domainName;
private $mailgunMessage;
@@ -48,6 +51,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
*/
public function send( PostmanMessage $message ) {
$options = PostmanOptions::getInstance();
+ $this->api_endpoint = ! is_null( $options->getMailgunRegion() ) ? 'https://api.eu.mailgun.net' : 'https://api.mailgun.net';
// add the Postman signature - append it to whatever the user may have set
if ( ! $options->isStealthModeEnabled() ) {
@@ -161,7 +165,10 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
$this->logger->debug( 'Sending mail' );
}
- $mg = Mailgun::create( $this->apiKey );
+ $configurator = new HttpClientConfigurator();
+ $configurator->setEndpoint( $this->api_endpoint . '/v3/'. $this->domainName .'/messages');
+ $configurator->setApiKey($this->apiKey);
+ $mg = Mailgun::configure($configurator);
// Make the call to the client.
$result = $this->processSend( $mg );