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:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user