mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Add amazon-ses.endpoint
configuration
Summary: Fixes T5116. Test Plan: Will test in production. Reviewers: chad Maniphest Tasks: T5116 Differential Revision: https://secure.phabricator.com/D15515
This commit is contained in:
parent
c0cb52dd78
commit
4a6589524b
4 changed files with 28 additions and 1 deletions
|
@ -64,6 +64,19 @@ final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck {
|
|||
->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();
|
||||
|
|
|
@ -27,6 +27,18 @@ final class PhabricatorAWSConfigOptions
|
|||
$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.')),
|
||||
|
|
|
@ -23,12 +23,13 @@ final class PhabricatorMailImplementationAmazonSESAdapter
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ To configure Phabricator to use Amazon SES, set these configuration keys:
|
|||
"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,
|
||||
|
|
Loading…
Reference in a new issue