diff --git a/src/applications/config/check/PhabricatorMailSetupCheck.php b/src/applications/config/check/PhabricatorMailSetupCheck.php --- a/src/applications/config/check/PhabricatorMailSetupCheck.php +++ b/src/applications/config/check/PhabricatorMailSetupCheck.php @@ -64,6 +64,19 @@ ->addPhabricatorConfig('amazon-ses.secret-key'); } + if (!PhabricatorEnv::getEnvConfig('amazon-ses.endpoint')) { + $message = pht( + 'Amazon SES is selected as the mail adapter, but no SES endpoint '. + 'is configured. Provide an SES endpoint or choose a different '. + 'mail adapter.'); + + $this->newIssue('config.amazon-ses.endpoint') + ->setName(pht('Amazon SES Endpoint Not Set')) + ->setMessage($message) + ->addRelatedPhabricatorConfig('metamta.mail-adapter') + ->addPhabricatorConfig('amazon-ses.endpoint'); + } + $address_key = 'metamta.default-address'; $options = PhabricatorApplicationConfigOptions::loadAllOptions(); $default = $options[$address_key]->getDefault(); diff --git a/src/applications/config/option/PhabricatorAWSConfigOptions.php b/src/applications/config/option/PhabricatorAWSConfigOptions.php --- a/src/applications/config/option/PhabricatorAWSConfigOptions.php +++ b/src/applications/config/option/PhabricatorAWSConfigOptions.php @@ -27,6 +27,18 @@ $this->newOption('amazon-ses.secret-key', 'string', null) ->setHidden(true) ->setDescription(pht('Secret key for Amazon SES.')), + $this->newOption('amazon-ses.endpoint', 'string', null) + ->setLocked(true) + ->setDescription( + pht( + 'SES endpoint domain name. You can find a list of available '. + 'regions and endpoints in the AWS documentation.')) + ->addExample( + 'email.us-east-1.amazonaws.com', + pht('US East (N. Virginia, Older default endpoint)')) + ->addExample( + 'email.us-west-2.amazonaws.com', + pht('US West (Oregon)')), $this->newOption('amazon-s3.access-key', 'string', null) ->setLocked(true) ->setDescription(pht('Access key for Amazon S3.')), diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php --- a/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php @@ -23,12 +23,13 @@ public function executeSend($body) { $key = PhabricatorEnv::getEnvConfig('amazon-ses.access-key'); $secret = PhabricatorEnv::getEnvConfig('amazon-ses.secret-key'); + $endpoint = PhabricatorEnv::getEnvConfig('amazon-ses.endpoint'); $root = phutil_get_library_root('phabricator'); $root = dirname($root); require_once $root.'/externals/amazon-ses/ses.php'; - $service = new SimpleEmailService($key, $secret); + $service = new SimpleEmailService($key, $secret, $endpoint); $service->enableUseExceptions(true); return $service->sendRawEmail($body); } diff --git a/src/docs/user/configuration/configuring_outbound_email.diviner b/src/docs/user/configuration/configuring_outbound_email.diviner --- a/src/docs/user/configuration/configuring_outbound_email.diviner +++ b/src/docs/user/configuration/configuring_outbound_email.diviner @@ -135,6 +135,7 @@ "PhabricatorMailImplementationAmazonSESAdapter". - **amazon-ses.access-key**: set to your Amazon SES access key. - **amazon-ses.secret-key**: set to your Amazon SES secret key. + - **amazon-ses.endpoint**: Set to your Amazon SES endpoint. NOTE: Amazon SES **requires you to verify your "From" address**. Configure which "From" address to use by setting "`metamta.default-address`" in your config,