1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Support EU domains for Mailgun API

Summary:
See <https://discourse.phabricator-community.org/t/mailgun-eu-zone-not-working/2332/4>.

Mailgun has a couple of API domains depending on where your account is based.

Test Plan:
  - Sent normal mail successfully with my non-EU account.
  - Waiting on user confirmation that this works in the EU.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20055
This commit is contained in:
epriestley 2019-01-29 06:07:43 -08:00
parent b9a1260ef5
commit 51cca22d07
2 changed files with 8 additions and 1 deletions

View file

@ -24,6 +24,7 @@ final class PhabricatorMailMailgunAdapter
array(
'api-key' => 'string',
'domain' => 'string',
'api-hostname' => 'string',
));
}
@ -31,12 +32,14 @@ final class PhabricatorMailMailgunAdapter
return array(
'api-key' => null,
'domain' => null,
'api-hostname' => 'api.mailgun.net',
);
}
public function sendMessage(PhabricatorMailExternalMessage $message) {
$api_key = $this->getOption('api-key');
$domain = $this->getOption('domain');
$api_hostname = $this->getOption('api-hostname');
$params = array();
$subject = $message->getSubject();
@ -92,7 +95,8 @@ final class PhabricatorMailMailgunAdapter
}
$mailgun_uri = urisprintf(
'https://api.mailgun.net/v2/%s/messages',
'https://%s/v2/%s/messages',
$api_hostname,
$domain);
$future = id(new HTTPSFuture($mailgun_uri, $params))

View file

@ -227,6 +227,9 @@ To use this mailer, set `type` to `mailgun`, then configure these `options`:
- `api-key`: Required string. Your Mailgun API key.
- `domain`: Required string. Your Mailgun domain.
- `api-hostname`: Optional string. Defaults to "api.mailgun.net". If your
account is in another region (like the EU), you may need to specify a
different hostname. Consult the Mailgun documentation.
Mailer: Amazon SES