mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Remove all legacy configuration options for mailers
Summary: Ref T920. About a year ago (in 2018 Week 6, see D19003) we moved from individually configured mailers to `cluster.mailers`, primarily to support fallback across multiple mail providers. Since this has been stable for quite a while, drop support for the older options. Test Plan: Grepped for all removed options. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T920 Differential Revision: https://secure.phabricator.com/D19940
This commit is contained in:
parent
cfcd35d8a3
commit
9d5b933ed5
19 changed files with 51 additions and 387 deletions
|
@ -3405,10 +3405,8 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorMailReceiverTestCase' => 'applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php',
|
'PhabricatorMailReceiverTestCase' => 'applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php',
|
||||||
'PhabricatorMailReplyHandler' => 'applications/metamta/replyhandler/PhabricatorMailReplyHandler.php',
|
'PhabricatorMailReplyHandler' => 'applications/metamta/replyhandler/PhabricatorMailReplyHandler.php',
|
||||||
'PhabricatorMailRoutingRule' => 'applications/metamta/constants/PhabricatorMailRoutingRule.php',
|
'PhabricatorMailRoutingRule' => 'applications/metamta/constants/PhabricatorMailRoutingRule.php',
|
||||||
'PhabricatorMailSetupCheck' => 'applications/config/check/PhabricatorMailSetupCheck.php',
|
|
||||||
'PhabricatorMailStamp' => 'applications/metamta/stamp/PhabricatorMailStamp.php',
|
'PhabricatorMailStamp' => 'applications/metamta/stamp/PhabricatorMailStamp.php',
|
||||||
'PhabricatorMailTarget' => 'applications/metamta/replyhandler/PhabricatorMailTarget.php',
|
'PhabricatorMailTarget' => 'applications/metamta/replyhandler/PhabricatorMailTarget.php',
|
||||||
'PhabricatorMailgunConfigOptions' => 'applications/config/option/PhabricatorMailgunConfigOptions.php',
|
|
||||||
'PhabricatorMainMenuBarExtension' => 'view/page/menu/PhabricatorMainMenuBarExtension.php',
|
'PhabricatorMainMenuBarExtension' => 'view/page/menu/PhabricatorMainMenuBarExtension.php',
|
||||||
'PhabricatorMainMenuSearchView' => 'view/page/menu/PhabricatorMainMenuSearchView.php',
|
'PhabricatorMainMenuSearchView' => 'view/page/menu/PhabricatorMainMenuSearchView.php',
|
||||||
'PhabricatorMainMenuView' => 'view/page/menu/PhabricatorMainMenuView.php',
|
'PhabricatorMainMenuView' => 'view/page/menu/PhabricatorMainMenuView.php',
|
||||||
|
@ -3657,7 +3655,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPHIDsSearchField' => 'applications/search/field/PhabricatorPHIDsSearchField.php',
|
'PhabricatorPHIDsSearchField' => 'applications/search/field/PhabricatorPHIDsSearchField.php',
|
||||||
'PhabricatorPHPASTApplication' => 'applications/phpast/application/PhabricatorPHPASTApplication.php',
|
'PhabricatorPHPASTApplication' => 'applications/phpast/application/PhabricatorPHPASTApplication.php',
|
||||||
'PhabricatorPHPConfigSetupCheck' => 'applications/config/check/PhabricatorPHPConfigSetupCheck.php',
|
'PhabricatorPHPConfigSetupCheck' => 'applications/config/check/PhabricatorPHPConfigSetupCheck.php',
|
||||||
'PhabricatorPHPMailerConfigOptions' => 'applications/config/option/PhabricatorPHPMailerConfigOptions.php',
|
|
||||||
'PhabricatorPHPPreflightSetupCheck' => 'applications/config/check/PhabricatorPHPPreflightSetupCheck.php',
|
'PhabricatorPHPPreflightSetupCheck' => 'applications/config/check/PhabricatorPHPPreflightSetupCheck.php',
|
||||||
'PhabricatorPackagesApplication' => 'applications/packages/application/PhabricatorPackagesApplication.php',
|
'PhabricatorPackagesApplication' => 'applications/packages/application/PhabricatorPackagesApplication.php',
|
||||||
'PhabricatorPackagesController' => 'applications/packages/controller/PhabricatorPackagesController.php',
|
'PhabricatorPackagesController' => 'applications/packages/controller/PhabricatorPackagesController.php',
|
||||||
|
@ -4312,7 +4309,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSecuritySetupCheck' => 'applications/config/check/PhabricatorSecuritySetupCheck.php',
|
'PhabricatorSecuritySetupCheck' => 'applications/config/check/PhabricatorSecuritySetupCheck.php',
|
||||||
'PhabricatorSelectEditField' => 'applications/transactions/editfield/PhabricatorSelectEditField.php',
|
'PhabricatorSelectEditField' => 'applications/transactions/editfield/PhabricatorSelectEditField.php',
|
||||||
'PhabricatorSelectSetting' => 'applications/settings/setting/PhabricatorSelectSetting.php',
|
'PhabricatorSelectSetting' => 'applications/settings/setting/PhabricatorSelectSetting.php',
|
||||||
'PhabricatorSendGridConfigOptions' => 'applications/config/option/PhabricatorSendGridConfigOptions.php',
|
|
||||||
'PhabricatorSessionsSettingsPanel' => 'applications/settings/panel/PhabricatorSessionsSettingsPanel.php',
|
'PhabricatorSessionsSettingsPanel' => 'applications/settings/panel/PhabricatorSessionsSettingsPanel.php',
|
||||||
'PhabricatorSetConfigType' => 'applications/config/type/PhabricatorSetConfigType.php',
|
'PhabricatorSetConfigType' => 'applications/config/type/PhabricatorSetConfigType.php',
|
||||||
'PhabricatorSetting' => 'applications/settings/setting/PhabricatorSetting.php',
|
'PhabricatorSetting' => 'applications/settings/setting/PhabricatorSetting.php',
|
||||||
|
@ -9214,10 +9210,8 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase',
|
'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorMailReplyHandler' => 'Phobject',
|
'PhabricatorMailReplyHandler' => 'Phobject',
|
||||||
'PhabricatorMailRoutingRule' => 'Phobject',
|
'PhabricatorMailRoutingRule' => 'Phobject',
|
||||||
'PhabricatorMailSetupCheck' => 'PhabricatorSetupCheck',
|
|
||||||
'PhabricatorMailStamp' => 'Phobject',
|
'PhabricatorMailStamp' => 'Phobject',
|
||||||
'PhabricatorMailTarget' => 'Phobject',
|
'PhabricatorMailTarget' => 'Phobject',
|
||||||
'PhabricatorMailgunConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
|
||||||
'PhabricatorMainMenuBarExtension' => 'Phobject',
|
'PhabricatorMainMenuBarExtension' => 'Phobject',
|
||||||
'PhabricatorMainMenuSearchView' => 'AphrontView',
|
'PhabricatorMainMenuSearchView' => 'AphrontView',
|
||||||
'PhabricatorMainMenuView' => 'AphrontView',
|
'PhabricatorMainMenuView' => 'AphrontView',
|
||||||
|
@ -9509,7 +9503,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPHIDsSearchField' => 'PhabricatorSearchField',
|
'PhabricatorPHIDsSearchField' => 'PhabricatorSearchField',
|
||||||
'PhabricatorPHPASTApplication' => 'PhabricatorApplication',
|
'PhabricatorPHPASTApplication' => 'PhabricatorApplication',
|
||||||
'PhabricatorPHPConfigSetupCheck' => 'PhabricatorSetupCheck',
|
'PhabricatorPHPConfigSetupCheck' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorPHPMailerConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
|
||||||
'PhabricatorPHPPreflightSetupCheck' => 'PhabricatorSetupCheck',
|
'PhabricatorPHPPreflightSetupCheck' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorPackagesApplication' => 'PhabricatorApplication',
|
'PhabricatorPackagesApplication' => 'PhabricatorApplication',
|
||||||
'PhabricatorPackagesController' => 'PhabricatorController',
|
'PhabricatorPackagesController' => 'PhabricatorController',
|
||||||
|
@ -10331,7 +10324,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSecuritySetupCheck' => 'PhabricatorSetupCheck',
|
'PhabricatorSecuritySetupCheck' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorSelectEditField' => 'PhabricatorEditField',
|
'PhabricatorSelectEditField' => 'PhabricatorEditField',
|
||||||
'PhabricatorSelectSetting' => 'PhabricatorSetting',
|
'PhabricatorSelectSetting' => 'PhabricatorSetting',
|
||||||
'PhabricatorSendGridConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
|
||||||
'PhabricatorSessionsSettingsPanel' => 'PhabricatorSettingsPanel',
|
'PhabricatorSessionsSettingsPanel' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSetConfigType' => 'PhabricatorTextConfigType',
|
'PhabricatorSetConfigType' => 'PhabricatorTextConfigType',
|
||||||
'PhabricatorSetting' => 'Phobject',
|
'PhabricatorSetting' => 'Phobject',
|
||||||
|
|
|
@ -193,12 +193,15 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
|
||||||
'in global settings.');
|
'in global settings.');
|
||||||
|
|
||||||
$dashboard_reason = pht(
|
$dashboard_reason = pht(
|
||||||
'This option has been removed, you can use Dashboards to provide '.
|
'This option has been removed, you can use Dashboards to provide '.
|
||||||
'homepage customization. See T11533 for more details.');
|
'homepage customization. See T11533 for more details.');
|
||||||
|
|
||||||
$elastic_reason = pht(
|
$elastic_reason = pht(
|
||||||
'Elasticsearch is now configured with "%s".',
|
'Elasticsearch is now configured with "%s".',
|
||||||
'cluster.search');
|
'cluster.search');
|
||||||
|
|
||||||
|
$mailers_reason = pht(
|
||||||
|
'Inbound and outbound mail is now configured with "cluster.mailers".');
|
||||||
|
|
||||||
$ancient_config += array(
|
$ancient_config += array(
|
||||||
'phid.external-loaders' =>
|
'phid.external-loaders' =>
|
||||||
|
@ -354,6 +357,21 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
|
||||||
'search.elastic.host' => $elastic_reason,
|
'search.elastic.host' => $elastic_reason,
|
||||||
'search.elastic.namespace' => $elastic_reason,
|
'search.elastic.namespace' => $elastic_reason,
|
||||||
|
|
||||||
|
'metamta.mail-adapter' => $mailers_reason,
|
||||||
|
'amazon-ses.access-key' => $mailers_reason,
|
||||||
|
'amazon-ses.secret-key' => $mailers_reason,
|
||||||
|
'amazon-ses.endpoint' => $mailers_reason,
|
||||||
|
'mailgun.domain' => $mailers_reason,
|
||||||
|
'mailgun.api-key' => $mailers_reason,
|
||||||
|
'phpmailer.mailer' => $mailers_reason,
|
||||||
|
'phpmailer.smtp-host' => $mailers_reason,
|
||||||
|
'phpmailer.smtp-port' => $mailers_reason,
|
||||||
|
'phpmailer.smtp-protocol' => $mailers_reason,
|
||||||
|
'phpmailer.smtp-user' => $mailers_reason,
|
||||||
|
'phpmailer.smtp-password' => $mailers_reason,
|
||||||
|
'phpmailer.smtp-encoding' => $mailers_reason,
|
||||||
|
'sendgrid.api-user' => $mailers_reason,
|
||||||
|
'sendgrid.api-key' => $mailers_reason,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $ancient_config;
|
return $ancient_config;
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck {
|
|
||||||
|
|
||||||
public function getDefaultGroup() {
|
|
||||||
return self::GROUP_OTHER;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function executeChecks() {
|
|
||||||
if (PhabricatorEnv::getEnvConfig('cluster.mailers')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
|
|
||||||
|
|
||||||
switch ($adapter) {
|
|
||||||
case 'PhabricatorMailImplementationPHPMailerLiteAdapter':
|
|
||||||
if (!Filesystem::pathExists('/usr/bin/sendmail') &&
|
|
||||||
!Filesystem::pathExists('/usr/sbin/sendmail')) {
|
|
||||||
$message = pht(
|
|
||||||
'Mail is configured to send via sendmail, but this system has '.
|
|
||||||
'no sendmail binary. Install sendmail or choose a different '.
|
|
||||||
'mail adapter.');
|
|
||||||
|
|
||||||
$this->newIssue('config.metamta.mail-adapter')
|
|
||||||
->setShortName(pht('Missing Sendmail'))
|
|
||||||
->setName(pht('No Sendmail Binary Found'))
|
|
||||||
->setMessage($message)
|
|
||||||
->addRelatedPhabricatorConfig('metamta.mail-adapter');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'PhabricatorMailImplementationAmazonSESAdapter':
|
|
||||||
if (PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) {
|
|
||||||
$message = pht(
|
|
||||||
'Amazon SES does not support sending email as users. Disable '.
|
|
||||||
'send as user, or choose a different mail adapter.');
|
|
||||||
|
|
||||||
$this->newIssue('config.can-send-as-user')
|
|
||||||
->setName(pht("SES Can't Send As User"))
|
|
||||||
->setMessage($message)
|
|
||||||
->addRelatedPhabricatorConfig('metamta.mail-adapter')
|
|
||||||
->addPhabricatorConfig('metamta.can-send-as-user');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PhabricatorEnv::getEnvConfig('amazon-ses.access-key')) {
|
|
||||||
$message = pht(
|
|
||||||
'Amazon SES is selected as the mail adapter, but no SES access '.
|
|
||||||
'key is configured. Provide an SES access key, or choose a '.
|
|
||||||
'different mail adapter.');
|
|
||||||
|
|
||||||
$this->newIssue('config.amazon-ses.access-key')
|
|
||||||
->setName(pht('Amazon SES Access Key Not Set'))
|
|
||||||
->setMessage($message)
|
|
||||||
->addRelatedPhabricatorConfig('metamta.mail-adapter')
|
|
||||||
->addPhabricatorConfig('amazon-ses.access-key');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PhabricatorEnv::getEnvConfig('amazon-ses.secret-key')) {
|
|
||||||
$message = pht(
|
|
||||||
'Amazon SES is selected as the mail adapter, but no SES secret '.
|
|
||||||
'key is configured. Provide an SES secret key, or choose a '.
|
|
||||||
'different mail adapter.');
|
|
||||||
|
|
||||||
$this->newIssue('config.amazon-ses.secret-key')
|
|
||||||
->setName(pht('Amazon SES Secret Key Not Set'))
|
|
||||||
->setMessage($message)
|
|
||||||
->addRelatedPhabricatorConfig('metamta.mail-adapter')
|
|
||||||
->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();
|
|
||||||
$value = PhabricatorEnv::getEnvConfig($address_key);
|
|
||||||
if ($default === $value) {
|
|
||||||
$message = pht(
|
|
||||||
'Amazon SES requires verification of the "From" address, but '.
|
|
||||||
'you have not configured a "From" address. Configure and verify '.
|
|
||||||
'a "From" address, or choose a different mail adapter.');
|
|
||||||
|
|
||||||
$this->newIssue('config.metamta.default-address')
|
|
||||||
->setName(pht('No SES From Address Configured'))
|
|
||||||
->setMessage($message)
|
|
||||||
->addRelatedPhabricatorConfig('metamta.mail-adapter')
|
|
||||||
->addPhabricatorConfig('metamta.default-address');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,24 +21,6 @@ final class PhabricatorAWSConfigOptions
|
||||||
|
|
||||||
public function getOptions() {
|
public function getOptions() {
|
||||||
return array(
|
return array(
|
||||||
$this->newOption('amazon-ses.access-key', 'string', null)
|
|
||||||
->setLocked(true)
|
|
||||||
->setDescription(pht('Access key for Amazon SES.')),
|
|
||||||
$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)
|
$this->newOption('amazon-s3.access-key', 'string', null)
|
||||||
->setLocked(true)
|
->setLocked(true)
|
||||||
->setDescription(pht('Access key for Amazon S3.')),
|
->setDescription(pht('Access key for Amazon S3.')),
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorMailgunConfigOptions
|
|
||||||
extends PhabricatorApplicationConfigOptions {
|
|
||||||
|
|
||||||
public function getName() {
|
|
||||||
return pht('Integration with Mailgun');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription() {
|
|
||||||
return pht('Configure Mailgun integration.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getIcon() {
|
|
||||||
return 'fa-send-o';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGroup() {
|
|
||||||
return 'core';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOptions() {
|
|
||||||
return array(
|
|
||||||
$this->newOption('mailgun.domain', 'string', null)
|
|
||||||
->setLocked(true)
|
|
||||||
->setDescription(
|
|
||||||
pht(
|
|
||||||
'Mailgun domain name. See %s.',
|
|
||||||
'https://mailgun.com/cp/domains'))
|
|
||||||
->addExample('mycompany.com', pht('Use specific domain')),
|
|
||||||
$this->newOption('mailgun.api-key', 'string', null)
|
|
||||||
->setHidden(true)
|
|
||||||
->setDescription(pht('Mailgun API key.')),
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -208,13 +208,6 @@ EODOC
|
||||||
'string',
|
'string',
|
||||||
'phabricator.example.com')
|
'phabricator.example.com')
|
||||||
->setDescription(pht('Domain used to generate Message-IDs.')),
|
->setDescription(pht('Domain used to generate Message-IDs.')),
|
||||||
$this->newOption(
|
|
||||||
'metamta.mail-adapter',
|
|
||||||
'class',
|
|
||||||
'PhabricatorMailImplementationPHPMailerLiteAdapter')
|
|
||||||
->setBaseClass('PhabricatorMailImplementationAdapter')
|
|
||||||
->setSummary(pht('Control how mail is sent.'))
|
|
||||||
->setDescription($adapter_description),
|
|
||||||
$this->newOption(
|
$this->newOption(
|
||||||
'metamta.one-mail-per-recipient',
|
'metamta.one-mail-per-recipient',
|
||||||
'bool',
|
'bool',
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorPHPMailerConfigOptions
|
|
||||||
extends PhabricatorApplicationConfigOptions {
|
|
||||||
|
|
||||||
public function getName() {
|
|
||||||
return pht('PHPMailer');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription() {
|
|
||||||
return pht('Configure PHPMailer.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getIcon() {
|
|
||||||
return 'fa-send-o';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGroup() {
|
|
||||||
return 'core';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOptions() {
|
|
||||||
return array(
|
|
||||||
$this->newOption('phpmailer.mailer', 'string', 'smtp')
|
|
||||||
->setLocked(true)
|
|
||||||
->setSummary(pht('Configure mailer used by PHPMailer.'))
|
|
||||||
->setDescription(
|
|
||||||
pht(
|
|
||||||
"If you're using PHPMailer to send email, provide the mailer and ".
|
|
||||||
"options here. PHPMailer is much more enormous than ".
|
|
||||||
"PHPMailerLite, and provides more mailers and greater enormity. ".
|
|
||||||
"You need it when you want to use SMTP instead of sendmail as the ".
|
|
||||||
"mailer.")),
|
|
||||||
$this->newOption('phpmailer.smtp-host', 'string', null)
|
|
||||||
->setLocked(true)
|
|
||||||
->setDescription(pht('Host for SMTP.')),
|
|
||||||
$this->newOption('phpmailer.smtp-port', 'int', 25)
|
|
||||||
->setLocked(true)
|
|
||||||
->setDescription(pht('Port for SMTP.')),
|
|
||||||
// TODO: Implement "enum"? Valid values are empty, 'tls', or 'ssl'.
|
|
||||||
$this->newOption('phpmailer.smtp-protocol', 'string', null)
|
|
||||||
->setLocked(true)
|
|
||||||
->setSummary(pht('Configure TLS or SSL for SMTP.'))
|
|
||||||
->setDescription(
|
|
||||||
pht(
|
|
||||||
"Using PHPMailer with SMTP, you can set this to one of '%s' or ".
|
|
||||||
"'%s' to use TLS or SSL, respectively. Leave it blank for ".
|
|
||||||
"vanilla SMTP. If you're sending via Gmail, set it to '%s'.",
|
|
||||||
'tls',
|
|
||||||
'ssl',
|
|
||||||
'ssl')),
|
|
||||||
$this->newOption('phpmailer.smtp-user', 'string', null)
|
|
||||||
->setLocked(true)
|
|
||||||
->setDescription(pht('Username for SMTP.')),
|
|
||||||
$this->newOption('phpmailer.smtp-password', 'string', null)
|
|
||||||
->setHidden(true)
|
|
||||||
->setDescription(pht('Password for SMTP.')),
|
|
||||||
$this->newOption('phpmailer.smtp-encoding', 'string', 'base64')
|
|
||||||
->setSummary(pht('Configure how mail is encoded.'))
|
|
||||||
->setDescription(
|
|
||||||
pht(
|
|
||||||
"Mail is normally encoded in `8bit`, which works correctly with ".
|
|
||||||
"most MTAs. However, some MTAs do not work well with this ".
|
|
||||||
"encoding. If you're having trouble with mail being mangled or ".
|
|
||||||
"arriving with too many or too few newlines, you may try ".
|
|
||||||
"adjusting this setting.\n\n".
|
|
||||||
"Supported values are `8bit`, `quoted-printable`, ".
|
|
||||||
"`7bit`, `binary` and `base64`.")),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorSendGridConfigOptions
|
|
||||||
extends PhabricatorApplicationConfigOptions {
|
|
||||||
|
|
||||||
public function getName() {
|
|
||||||
return pht('Integration with SendGrid');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription() {
|
|
||||||
return pht('Configure SendGrid integration.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getIcon() {
|
|
||||||
return 'fa-send-o';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGroup() {
|
|
||||||
return 'core';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOptions() {
|
|
||||||
return array(
|
|
||||||
$this->newOption('sendgrid.api-user', 'string', null)
|
|
||||||
->setLocked(true)
|
|
||||||
->setDescription(pht('SendGrid API username.')),
|
|
||||||
$this->newOption('sendgrid.api-key', 'string', null)
|
|
||||||
->setHidden(true)
|
|
||||||
->setDescription(pht('SendGrid API key.')),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -109,7 +109,6 @@ abstract class PhabricatorMailImplementationAdapter extends Phobject {
|
||||||
abstract protected function validateOptions(array $options);
|
abstract protected function validateOptions(array $options);
|
||||||
|
|
||||||
abstract public function newDefaultOptions();
|
abstract public function newDefaultOptions();
|
||||||
abstract public function newLegacyOptions();
|
|
||||||
|
|
||||||
public function prepareForSend() {
|
public function prepareForSend() {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -39,15 +39,6 @@ final class PhabricatorMailImplementationAmazonSESAdapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array(
|
|
||||||
'access-key' => PhabricatorEnv::getEnvConfig('amazon-ses.access-key'),
|
|
||||||
'secret-key' => PhabricatorEnv::getEnvConfig('amazon-ses.secret-key'),
|
|
||||||
'endpoint' => PhabricatorEnv::getEnvConfig('amazon-ses.endpoint'),
|
|
||||||
'encoding' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-encoding'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phutil-external-symbol class SimpleEmailService
|
* @phutil-external-symbol class SimpleEmailService
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,13 +89,6 @@ final class PhabricatorMailImplementationMailgunAdapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array(
|
|
||||||
'api-key' => PhabricatorEnv::getEnvConfig('mailgun.api-key'),
|
|
||||||
'domain' => PhabricatorEnv::getEnvConfig('mailgun.domain'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function send() {
|
public function send() {
|
||||||
$key = $this->getOption('api-key');
|
$key = $this->getOption('api-key');
|
||||||
$domain = $this->getOption('domain');
|
$domain = $this->getOption('domain');
|
||||||
|
|
|
@ -33,18 +33,6 @@ final class PhabricatorMailImplementationPHPMailerAdapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array(
|
|
||||||
'host' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-host'),
|
|
||||||
'port' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-port'),
|
|
||||||
'user' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-user'),
|
|
||||||
'password' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-password'),
|
|
||||||
'protocol' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-protocol'),
|
|
||||||
'encoding' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-encoding'),
|
|
||||||
'mailer' => PhabricatorEnv::getEnvConfig('phpmailer.mailer'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phutil-external-symbol class PHPMailer
|
* @phutil-external-symbol class PHPMailer
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,12 +24,6 @@ class PhabricatorMailImplementationPHPMailerLiteAdapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array(
|
|
||||||
'encoding' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-encoding'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phutil-external-symbol class PHPMailerLite
|
* @phutil-external-symbol class PHPMailerLite
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -94,10 +94,6 @@ final class PhabricatorMailImplementationPostmarkAdapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function send() {
|
public function send() {
|
||||||
$access_token = $this->getOption('access-token');
|
$access_token = $this->getOption('access-token');
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,6 @@ final class PhabricatorMailImplementationSendGridAdapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array(
|
|
||||||
'api-user' => PhabricatorEnv::getEnvConfig('sendgrid.api-user'),
|
|
||||||
'api-key' => PhabricatorEnv::getEnvConfig('sendgrid.api-key'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFrom($email, $name = '') {
|
public function setFrom($email, $name = '') {
|
||||||
$this->params['from'] = $email;
|
$this->params['from'] = $email;
|
||||||
$this->params['from-name'] = $name;
|
$this->params['from-name'] = $name;
|
||||||
|
@ -97,18 +90,9 @@ final class PhabricatorMailImplementationSendGridAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
public function send() {
|
public function send() {
|
||||||
|
|
||||||
$user = $this->getOption('api-user');
|
$user = $this->getOption('api-user');
|
||||||
$key = $this->getOption('api-key');
|
$key = $this->getOption('api-key');
|
||||||
|
|
||||||
if (!$user || !$key) {
|
|
||||||
throw new Exception(
|
|
||||||
pht(
|
|
||||||
"Configure '%s' and '%s' to use SendGrid for mail delivery.",
|
|
||||||
'sendgrid.api-user',
|
|
||||||
'sendgrid.api-key'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
$ii = 0;
|
$ii = 0;
|
||||||
|
|
|
@ -22,10 +22,6 @@ final class PhabricatorMailImplementationTestAdapter
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newLegacyOptions() {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function prepareForSend(array $config = array()) {
|
public function prepareForSend(array $config = array()) {
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,53 +520,38 @@ final class PhabricatorMetaMTAMail
|
||||||
$mailers = array();
|
$mailers = array();
|
||||||
|
|
||||||
$config = PhabricatorEnv::getEnvConfig('cluster.mailers');
|
$config = PhabricatorEnv::getEnvConfig('cluster.mailers');
|
||||||
if ($config === null) {
|
|
||||||
$mailer = PhabricatorEnv::newObjectFromConfig('metamta.mail-adapter');
|
$adapters = PhabricatorMailImplementationAdapter::getAllAdapters();
|
||||||
|
$next_priority = -1;
|
||||||
|
|
||||||
|
foreach ($config as $spec) {
|
||||||
|
$type = $spec['type'];
|
||||||
|
if (!isset($adapters[$type])) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Unknown mailer ("%s")!',
|
||||||
|
$type));
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = $spec['key'];
|
||||||
|
$mailer = id(clone $adapters[$type])
|
||||||
|
->setKey($key);
|
||||||
|
|
||||||
|
$priority = idx($spec, 'priority');
|
||||||
|
if (!$priority) {
|
||||||
|
$priority = $next_priority;
|
||||||
|
$next_priority--;
|
||||||
|
}
|
||||||
|
$mailer->setPriority($priority);
|
||||||
|
|
||||||
$defaults = $mailer->newDefaultOptions();
|
$defaults = $mailer->newDefaultOptions();
|
||||||
$options = $mailer->newLegacyOptions();
|
$options = idx($spec, 'options', array()) + $defaults;
|
||||||
|
$mailer->setOptions($options);
|
||||||
|
|
||||||
$options = $options + $defaults;
|
$mailer->setSupportsInbound(idx($spec, 'inbound', true));
|
||||||
|
$mailer->setSupportsOutbound(idx($spec, 'outbound', true));
|
||||||
$mailer
|
|
||||||
->setKey('default')
|
|
||||||
->setPriority(-1)
|
|
||||||
->setOptions($options);
|
|
||||||
|
|
||||||
$mailers[] = $mailer;
|
$mailers[] = $mailer;
|
||||||
} else {
|
|
||||||
$adapters = PhabricatorMailImplementationAdapter::getAllAdapters();
|
|
||||||
$next_priority = -1;
|
|
||||||
|
|
||||||
foreach ($config as $spec) {
|
|
||||||
$type = $spec['type'];
|
|
||||||
if (!isset($adapters[$type])) {
|
|
||||||
throw new Exception(
|
|
||||||
pht(
|
|
||||||
'Unknown mailer ("%s")!',
|
|
||||||
$type));
|
|
||||||
}
|
|
||||||
|
|
||||||
$key = $spec['key'];
|
|
||||||
$mailer = id(clone $adapters[$type])
|
|
||||||
->setKey($key);
|
|
||||||
|
|
||||||
$priority = idx($spec, 'priority');
|
|
||||||
if (!$priority) {
|
|
||||||
$priority = $next_priority;
|
|
||||||
$next_priority--;
|
|
||||||
}
|
|
||||||
$mailer->setPriority($priority);
|
|
||||||
|
|
||||||
$defaults = $mailer->newDefaultOptions();
|
|
||||||
$options = idx($spec, 'options', array()) + $defaults;
|
|
||||||
$mailer->setOptions($options);
|
|
||||||
|
|
||||||
$mailer->setSupportsInbound(idx($spec, 'inbound', true));
|
|
||||||
$mailer->setSupportsOutbound(idx($spec, 'outbound', true));
|
|
||||||
|
|
||||||
$mailers[] = $mailer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove mailers with the wrong types.
|
// Remove mailers with the wrong types.
|
||||||
|
|
|
@ -82,7 +82,7 @@ access to fix any mistakes.
|
||||||
attacker who has gained access to an administrator account in order to gain
|
attacker who has gained access to an administrator account in order to gain
|
||||||
greater access.
|
greater access.
|
||||||
|
|
||||||
For example, an attacker who could modify `metamta.mail-adapter` (and other
|
For example, an attacker who could modify `cluster.mailers` (and other
|
||||||
similar options), could potentially reconfigure Phabricator to send mail
|
similar options), could potentially reconfigure Phabricator to send mail
|
||||||
through an evil server they controlled, then trigger password resets on other
|
through an evil server they controlled, then trigger password resets on other
|
||||||
user accounts to compromise them.
|
user accounts to compromise them.
|
||||||
|
|
|
@ -129,7 +129,7 @@ like this:
|
||||||
- Add a Mailgun route with a `catch_all()` rule which takes the action
|
- Add a Mailgun route with a `catch_all()` rule which takes the action
|
||||||
`forward("https://phabricator.example.com/mail/mailgun/")`. Replace the
|
`forward("https://phabricator.example.com/mail/mailgun/")`. Replace the
|
||||||
example domain with your actual domain.
|
example domain with your actual domain.
|
||||||
- Set the `mailgun.api-key` config key to your Mailgun API key.
|
- Configure a mailer in `cluster.mailers` with your Mailgun API key.
|
||||||
|
|
||||||
Postmark Setup
|
Postmark Setup
|
||||||
==============
|
==============
|
||||||
|
|
Loading…
Reference in a new issue