@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+49 -385
-8
src/__phutil_library_map__.php
··· 3405 3405 'PhabricatorMailReceiverTestCase' => 'applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php', 3406 3406 'PhabricatorMailReplyHandler' => 'applications/metamta/replyhandler/PhabricatorMailReplyHandler.php', 3407 3407 'PhabricatorMailRoutingRule' => 'applications/metamta/constants/PhabricatorMailRoutingRule.php', 3408 - 'PhabricatorMailSetupCheck' => 'applications/config/check/PhabricatorMailSetupCheck.php', 3409 3408 'PhabricatorMailStamp' => 'applications/metamta/stamp/PhabricatorMailStamp.php', 3410 3409 'PhabricatorMailTarget' => 'applications/metamta/replyhandler/PhabricatorMailTarget.php', 3411 - 'PhabricatorMailgunConfigOptions' => 'applications/config/option/PhabricatorMailgunConfigOptions.php', 3412 3410 'PhabricatorMainMenuBarExtension' => 'view/page/menu/PhabricatorMainMenuBarExtension.php', 3413 3411 'PhabricatorMainMenuSearchView' => 'view/page/menu/PhabricatorMainMenuSearchView.php', 3414 3412 'PhabricatorMainMenuView' => 'view/page/menu/PhabricatorMainMenuView.php', ··· 3657 3655 'PhabricatorPHIDsSearchField' => 'applications/search/field/PhabricatorPHIDsSearchField.php', 3658 3656 'PhabricatorPHPASTApplication' => 'applications/phpast/application/PhabricatorPHPASTApplication.php', 3659 3657 'PhabricatorPHPConfigSetupCheck' => 'applications/config/check/PhabricatorPHPConfigSetupCheck.php', 3660 - 'PhabricatorPHPMailerConfigOptions' => 'applications/config/option/PhabricatorPHPMailerConfigOptions.php', 3661 3658 'PhabricatorPHPPreflightSetupCheck' => 'applications/config/check/PhabricatorPHPPreflightSetupCheck.php', 3662 3659 'PhabricatorPackagesApplication' => 'applications/packages/application/PhabricatorPackagesApplication.php', 3663 3660 'PhabricatorPackagesController' => 'applications/packages/controller/PhabricatorPackagesController.php', ··· 4312 4309 'PhabricatorSecuritySetupCheck' => 'applications/config/check/PhabricatorSecuritySetupCheck.php', 4313 4310 'PhabricatorSelectEditField' => 'applications/transactions/editfield/PhabricatorSelectEditField.php', 4314 4311 'PhabricatorSelectSetting' => 'applications/settings/setting/PhabricatorSelectSetting.php', 4315 - 'PhabricatorSendGridConfigOptions' => 'applications/config/option/PhabricatorSendGridConfigOptions.php', 4316 4312 'PhabricatorSessionsSettingsPanel' => 'applications/settings/panel/PhabricatorSessionsSettingsPanel.php', 4317 4313 'PhabricatorSetConfigType' => 'applications/config/type/PhabricatorSetConfigType.php', 4318 4314 'PhabricatorSetting' => 'applications/settings/setting/PhabricatorSetting.php', ··· 9214 9210 'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase', 9215 9211 'PhabricatorMailReplyHandler' => 'Phobject', 9216 9212 'PhabricatorMailRoutingRule' => 'Phobject', 9217 - 'PhabricatorMailSetupCheck' => 'PhabricatorSetupCheck', 9218 9213 'PhabricatorMailStamp' => 'Phobject', 9219 9214 'PhabricatorMailTarget' => 'Phobject', 9220 - 'PhabricatorMailgunConfigOptions' => 'PhabricatorApplicationConfigOptions', 9221 9215 'PhabricatorMainMenuBarExtension' => 'Phobject', 9222 9216 'PhabricatorMainMenuSearchView' => 'AphrontView', 9223 9217 'PhabricatorMainMenuView' => 'AphrontView', ··· 9509 9503 'PhabricatorPHIDsSearchField' => 'PhabricatorSearchField', 9510 9504 'PhabricatorPHPASTApplication' => 'PhabricatorApplication', 9511 9505 'PhabricatorPHPConfigSetupCheck' => 'PhabricatorSetupCheck', 9512 - 'PhabricatorPHPMailerConfigOptions' => 'PhabricatorApplicationConfigOptions', 9513 9506 'PhabricatorPHPPreflightSetupCheck' => 'PhabricatorSetupCheck', 9514 9507 'PhabricatorPackagesApplication' => 'PhabricatorApplication', 9515 9508 'PhabricatorPackagesController' => 'PhabricatorController', ··· 10331 10324 'PhabricatorSecuritySetupCheck' => 'PhabricatorSetupCheck', 10332 10325 'PhabricatorSelectEditField' => 'PhabricatorEditField', 10333 10326 'PhabricatorSelectSetting' => 'PhabricatorSetting', 10334 - 'PhabricatorSendGridConfigOptions' => 'PhabricatorApplicationConfigOptions', 10335 10327 'PhabricatorSessionsSettingsPanel' => 'PhabricatorSettingsPanel', 10336 10328 'PhabricatorSetConfigType' => 'PhabricatorTextConfigType', 10337 10329 'PhabricatorSetting' => 'Phobject',
+22 -4
src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
··· 193 193 'in global settings.'); 194 194 195 195 $dashboard_reason = pht( 196 - 'This option has been removed, you can use Dashboards to provide '. 197 - 'homepage customization. See T11533 for more details.'); 196 + 'This option has been removed, you can use Dashboards to provide '. 197 + 'homepage customization. See T11533 for more details.'); 198 198 199 199 $elastic_reason = pht( 200 - 'Elasticsearch is now configured with "%s".', 201 - 'cluster.search'); 200 + 'Elasticsearch is now configured with "%s".', 201 + 'cluster.search'); 202 + 203 + $mailers_reason = pht( 204 + 'Inbound and outbound mail is now configured with "cluster.mailers".'); 202 205 203 206 $ancient_config += array( 204 207 'phid.external-loaders' => ··· 354 357 'search.elastic.host' => $elastic_reason, 355 358 'search.elastic.namespace' => $elastic_reason, 356 359 360 + 'metamta.mail-adapter' => $mailers_reason, 361 + 'amazon-ses.access-key' => $mailers_reason, 362 + 'amazon-ses.secret-key' => $mailers_reason, 363 + 'amazon-ses.endpoint' => $mailers_reason, 364 + 'mailgun.domain' => $mailers_reason, 365 + 'mailgun.api-key' => $mailers_reason, 366 + 'phpmailer.mailer' => $mailers_reason, 367 + 'phpmailer.smtp-host' => $mailers_reason, 368 + 'phpmailer.smtp-port' => $mailers_reason, 369 + 'phpmailer.smtp-protocol' => $mailers_reason, 370 + 'phpmailer.smtp-user' => $mailers_reason, 371 + 'phpmailer.smtp-password' => $mailers_reason, 372 + 'phpmailer.smtp-encoding' => $mailers_reason, 373 + 'sendgrid.api-user' => $mailers_reason, 374 + 'sendgrid.api-key' => $mailers_reason, 357 375 ); 358 376 359 377 return $ancient_config;
-104
src/applications/config/check/PhabricatorMailSetupCheck.php
··· 1 - <?php 2 - 3 - final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck { 4 - 5 - public function getDefaultGroup() { 6 - return self::GROUP_OTHER; 7 - } 8 - 9 - protected function executeChecks() { 10 - if (PhabricatorEnv::getEnvConfig('cluster.mailers')) { 11 - return; 12 - } 13 - 14 - $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter'); 15 - 16 - switch ($adapter) { 17 - case 'PhabricatorMailImplementationPHPMailerLiteAdapter': 18 - if (!Filesystem::pathExists('/usr/bin/sendmail') && 19 - !Filesystem::pathExists('/usr/sbin/sendmail')) { 20 - $message = pht( 21 - 'Mail is configured to send via sendmail, but this system has '. 22 - 'no sendmail binary. Install sendmail or choose a different '. 23 - 'mail adapter.'); 24 - 25 - $this->newIssue('config.metamta.mail-adapter') 26 - ->setShortName(pht('Missing Sendmail')) 27 - ->setName(pht('No Sendmail Binary Found')) 28 - ->setMessage($message) 29 - ->addRelatedPhabricatorConfig('metamta.mail-adapter'); 30 - } 31 - break; 32 - case 'PhabricatorMailImplementationAmazonSESAdapter': 33 - if (PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) { 34 - $message = pht( 35 - 'Amazon SES does not support sending email as users. Disable '. 36 - 'send as user, or choose a different mail adapter.'); 37 - 38 - $this->newIssue('config.can-send-as-user') 39 - ->setName(pht("SES Can't Send As User")) 40 - ->setMessage($message) 41 - ->addRelatedPhabricatorConfig('metamta.mail-adapter') 42 - ->addPhabricatorConfig('metamta.can-send-as-user'); 43 - } 44 - 45 - if (!PhabricatorEnv::getEnvConfig('amazon-ses.access-key')) { 46 - $message = pht( 47 - 'Amazon SES is selected as the mail adapter, but no SES access '. 48 - 'key is configured. Provide an SES access key, or choose a '. 49 - 'different mail adapter.'); 50 - 51 - $this->newIssue('config.amazon-ses.access-key') 52 - ->setName(pht('Amazon SES Access Key Not Set')) 53 - ->setMessage($message) 54 - ->addRelatedPhabricatorConfig('metamta.mail-adapter') 55 - ->addPhabricatorConfig('amazon-ses.access-key'); 56 - } 57 - 58 - if (!PhabricatorEnv::getEnvConfig('amazon-ses.secret-key')) { 59 - $message = pht( 60 - 'Amazon SES is selected as the mail adapter, but no SES secret '. 61 - 'key is configured. Provide an SES secret key, or choose a '. 62 - 'different mail adapter.'); 63 - 64 - $this->newIssue('config.amazon-ses.secret-key') 65 - ->setName(pht('Amazon SES Secret Key Not Set')) 66 - ->setMessage($message) 67 - ->addRelatedPhabricatorConfig('metamta.mail-adapter') 68 - ->addPhabricatorConfig('amazon-ses.secret-key'); 69 - } 70 - 71 - if (!PhabricatorEnv::getEnvConfig('amazon-ses.endpoint')) { 72 - $message = pht( 73 - 'Amazon SES is selected as the mail adapter, but no SES endpoint '. 74 - 'is configured. Provide an SES endpoint or choose a different '. 75 - 'mail adapter.'); 76 - 77 - $this->newIssue('config.amazon-ses.endpoint') 78 - ->setName(pht('Amazon SES Endpoint Not Set')) 79 - ->setMessage($message) 80 - ->addRelatedPhabricatorConfig('metamta.mail-adapter') 81 - ->addPhabricatorConfig('amazon-ses.endpoint'); 82 - } 83 - 84 - $address_key = 'metamta.default-address'; 85 - $options = PhabricatorApplicationConfigOptions::loadAllOptions(); 86 - $default = $options[$address_key]->getDefault(); 87 - $value = PhabricatorEnv::getEnvConfig($address_key); 88 - if ($default === $value) { 89 - $message = pht( 90 - 'Amazon SES requires verification of the "From" address, but '. 91 - 'you have not configured a "From" address. Configure and verify '. 92 - 'a "From" address, or choose a different mail adapter.'); 93 - 94 - $this->newIssue('config.metamta.default-address') 95 - ->setName(pht('No SES From Address Configured')) 96 - ->setMessage($message) 97 - ->addRelatedPhabricatorConfig('metamta.mail-adapter') 98 - ->addPhabricatorConfig('metamta.default-address'); 99 - } 100 - break; 101 - } 102 - 103 - } 104 - }
-18
src/applications/config/option/PhabricatorAWSConfigOptions.php
··· 21 21 22 22 public function getOptions() { 23 23 return array( 24 - $this->newOption('amazon-ses.access-key', 'string', null) 25 - ->setLocked(true) 26 - ->setDescription(pht('Access key for Amazon SES.')), 27 - $this->newOption('amazon-ses.secret-key', 'string', null) 28 - ->setHidden(true) 29 - ->setDescription(pht('Secret key for Amazon SES.')), 30 - $this->newOption('amazon-ses.endpoint', 'string', null) 31 - ->setLocked(true) 32 - ->setDescription( 33 - pht( 34 - 'SES endpoint domain name. You can find a list of available '. 35 - 'regions and endpoints in the AWS documentation.')) 36 - ->addExample( 37 - 'email.us-east-1.amazonaws.com', 38 - pht('US East (N. Virginia, Older default endpoint)')) 39 - ->addExample( 40 - 'email.us-west-2.amazonaws.com', 41 - pht('US West (Oregon)')), 42 24 $this->newOption('amazon-s3.access-key', 'string', null) 43 25 ->setLocked(true) 44 26 ->setDescription(pht('Access key for Amazon S3.')),
-38
src/applications/config/option/PhabricatorMailgunConfigOptions.php
··· 1 - <?php 2 - 3 - final class PhabricatorMailgunConfigOptions 4 - extends PhabricatorApplicationConfigOptions { 5 - 6 - public function getName() { 7 - return pht('Integration with Mailgun'); 8 - } 9 - 10 - public function getDescription() { 11 - return pht('Configure Mailgun integration.'); 12 - } 13 - 14 - public function getIcon() { 15 - return 'fa-send-o'; 16 - } 17 - 18 - public function getGroup() { 19 - return 'core'; 20 - } 21 - 22 - public function getOptions() { 23 - return array( 24 - $this->newOption('mailgun.domain', 'string', null) 25 - ->setLocked(true) 26 - ->setDescription( 27 - pht( 28 - 'Mailgun domain name. See %s.', 29 - 'https://mailgun.com/cp/domains')) 30 - ->addExample('mycompany.com', pht('Use specific domain')), 31 - $this->newOption('mailgun.api-key', 'string', null) 32 - ->setHidden(true) 33 - ->setDescription(pht('Mailgun API key.')), 34 - ); 35 - 36 - } 37 - 38 - }
-7
src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
··· 209 209 'phabricator.example.com') 210 210 ->setDescription(pht('Domain used to generate Message-IDs.')), 211 211 $this->newOption( 212 - 'metamta.mail-adapter', 213 - 'class', 214 - 'PhabricatorMailImplementationPHPMailerLiteAdapter') 215 - ->setBaseClass('PhabricatorMailImplementationAdapter') 216 - ->setSummary(pht('Control how mail is sent.')) 217 - ->setDescription($adapter_description), 218 - $this->newOption( 219 212 'metamta.one-mail-per-recipient', 220 213 'bool', 221 214 true)
-72
src/applications/config/option/PhabricatorPHPMailerConfigOptions.php
··· 1 - <?php 2 - 3 - final class PhabricatorPHPMailerConfigOptions 4 - extends PhabricatorApplicationConfigOptions { 5 - 6 - public function getName() { 7 - return pht('PHPMailer'); 8 - } 9 - 10 - public function getDescription() { 11 - return pht('Configure PHPMailer.'); 12 - } 13 - 14 - public function getIcon() { 15 - return 'fa-send-o'; 16 - } 17 - 18 - public function getGroup() { 19 - return 'core'; 20 - } 21 - 22 - public function getOptions() { 23 - return array( 24 - $this->newOption('phpmailer.mailer', 'string', 'smtp') 25 - ->setLocked(true) 26 - ->setSummary(pht('Configure mailer used by PHPMailer.')) 27 - ->setDescription( 28 - pht( 29 - "If you're using PHPMailer to send email, provide the mailer and ". 30 - "options here. PHPMailer is much more enormous than ". 31 - "PHPMailerLite, and provides more mailers and greater enormity. ". 32 - "You need it when you want to use SMTP instead of sendmail as the ". 33 - "mailer.")), 34 - $this->newOption('phpmailer.smtp-host', 'string', null) 35 - ->setLocked(true) 36 - ->setDescription(pht('Host for SMTP.')), 37 - $this->newOption('phpmailer.smtp-port', 'int', 25) 38 - ->setLocked(true) 39 - ->setDescription(pht('Port for SMTP.')), 40 - // TODO: Implement "enum"? Valid values are empty, 'tls', or 'ssl'. 41 - $this->newOption('phpmailer.smtp-protocol', 'string', null) 42 - ->setLocked(true) 43 - ->setSummary(pht('Configure TLS or SSL for SMTP.')) 44 - ->setDescription( 45 - pht( 46 - "Using PHPMailer with SMTP, you can set this to one of '%s' or ". 47 - "'%s' to use TLS or SSL, respectively. Leave it blank for ". 48 - "vanilla SMTP. If you're sending via Gmail, set it to '%s'.", 49 - 'tls', 50 - 'ssl', 51 - 'ssl')), 52 - $this->newOption('phpmailer.smtp-user', 'string', null) 53 - ->setLocked(true) 54 - ->setDescription(pht('Username for SMTP.')), 55 - $this->newOption('phpmailer.smtp-password', 'string', null) 56 - ->setHidden(true) 57 - ->setDescription(pht('Password for SMTP.')), 58 - $this->newOption('phpmailer.smtp-encoding', 'string', 'base64') 59 - ->setSummary(pht('Configure how mail is encoded.')) 60 - ->setDescription( 61 - pht( 62 - "Mail is normally encoded in `8bit`, which works correctly with ". 63 - "most MTAs. However, some MTAs do not work well with this ". 64 - "encoding. If you're having trouble with mail being mangled or ". 65 - "arriving with too many or too few newlines, you may try ". 66 - "adjusting this setting.\n\n". 67 - "Supported values are `8bit`, `quoted-printable`, ". 68 - "`7bit`, `binary` and `base64`.")), 69 - ); 70 - } 71 - 72 - }
-33
src/applications/config/option/PhabricatorSendGridConfigOptions.php
··· 1 - <?php 2 - 3 - final class PhabricatorSendGridConfigOptions 4 - extends PhabricatorApplicationConfigOptions { 5 - 6 - public function getName() { 7 - return pht('Integration with SendGrid'); 8 - } 9 - 10 - public function getDescription() { 11 - return pht('Configure SendGrid integration.'); 12 - } 13 - 14 - public function getIcon() { 15 - return 'fa-send-o'; 16 - } 17 - 18 - public function getGroup() { 19 - return 'core'; 20 - } 21 - 22 - public function getOptions() { 23 - return array( 24 - $this->newOption('sendgrid.api-user', 'string', null) 25 - ->setLocked(true) 26 - ->setDescription(pht('SendGrid API username.')), 27 - $this->newOption('sendgrid.api-key', 'string', null) 28 - ->setHidden(true) 29 - ->setDescription(pht('SendGrid API key.')), 30 - ); 31 - } 32 - 33 - }
-1
src/applications/metamta/adapter/PhabricatorMailImplementationAdapter.php
··· 109 109 abstract protected function validateOptions(array $options); 110 110 111 111 abstract public function newDefaultOptions(); 112 - abstract public function newLegacyOptions(); 113 112 114 113 public function prepareForSend() { 115 114 return;
-9
src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php
··· 39 39 ); 40 40 } 41 41 42 - public function newLegacyOptions() { 43 - return array( 44 - 'access-key' => PhabricatorEnv::getEnvConfig('amazon-ses.access-key'), 45 - 'secret-key' => PhabricatorEnv::getEnvConfig('amazon-ses.secret-key'), 46 - 'endpoint' => PhabricatorEnv::getEnvConfig('amazon-ses.endpoint'), 47 - 'encoding' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-encoding'), 48 - ); 49 - } 50 - 51 42 /** 52 43 * @phutil-external-symbol class SimpleEmailService 53 44 */
-7
src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
··· 89 89 ); 90 90 } 91 91 92 - public function newLegacyOptions() { 93 - return array( 94 - 'api-key' => PhabricatorEnv::getEnvConfig('mailgun.api-key'), 95 - 'domain' => PhabricatorEnv::getEnvConfig('mailgun.domain'), 96 - ); 97 - } 98 - 99 92 public function send() { 100 93 $key = $this->getOption('api-key'); 101 94 $domain = $this->getOption('domain');
-12
src/applications/metamta/adapter/PhabricatorMailImplementationPHPMailerAdapter.php
··· 33 33 ); 34 34 } 35 35 36 - public function newLegacyOptions() { 37 - return array( 38 - 'host' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-host'), 39 - 'port' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-port'), 40 - 'user' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-user'), 41 - 'password' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-password'), 42 - 'protocol' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-protocol'), 43 - 'encoding' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-encoding'), 44 - 'mailer' => PhabricatorEnv::getEnvConfig('phpmailer.mailer'), 45 - ); 46 - } 47 - 48 36 /** 49 37 * @phutil-external-symbol class PHPMailer 50 38 */
-6
src/applications/metamta/adapter/PhabricatorMailImplementationPHPMailerLiteAdapter.php
··· 24 24 ); 25 25 } 26 26 27 - public function newLegacyOptions() { 28 - return array( 29 - 'encoding' => PhabricatorEnv::getEnvConfig('phpmailer.smtp-encoding'), 30 - ); 31 - } 32 - 33 27 /** 34 28 * @phutil-external-symbol class PHPMailerLite 35 29 */
-4
src/applications/metamta/adapter/PhabricatorMailImplementationPostmarkAdapter.php
··· 94 94 ); 95 95 } 96 96 97 - public function newLegacyOptions() { 98 - return array(); 99 - } 100 - 101 97 public function send() { 102 98 $access_token = $this->getOption('access-token'); 103 99
-16
src/applications/metamta/adapter/PhabricatorMailImplementationSendGridAdapter.php
··· 26 26 ); 27 27 } 28 28 29 - public function newLegacyOptions() { 30 - return array( 31 - 'api-user' => PhabricatorEnv::getEnvConfig('sendgrid.api-user'), 32 - 'api-key' => PhabricatorEnv::getEnvConfig('sendgrid.api-key'), 33 - ); 34 - } 35 - 36 29 public function setFrom($email, $name = '') { 37 30 $this->params['from'] = $email; 38 31 $this->params['from-name'] = $name; ··· 97 90 } 98 91 99 92 public function send() { 100 - 101 93 $user = $this->getOption('api-user'); 102 94 $key = $this->getOption('api-key'); 103 - 104 - if (!$user || !$key) { 105 - throw new Exception( 106 - pht( 107 - "Configure '%s' and '%s' to use SendGrid for mail delivery.", 108 - 'sendgrid.api-user', 109 - 'sendgrid.api-key')); 110 - } 111 95 112 96 $params = array(); 113 97
-4
src/applications/metamta/adapter/PhabricatorMailImplementationTestAdapter.php
··· 22 22 return array(); 23 23 } 24 24 25 - public function newLegacyOptions() { 26 - return array(); 27 - } 28 - 29 25 public function prepareForSend(array $config = array()) { 30 26 $this->config = $config; 31 27 }
+25 -40
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 520 520 $mailers = array(); 521 521 522 522 $config = PhabricatorEnv::getEnvConfig('cluster.mailers'); 523 - if ($config === null) { 524 - $mailer = PhabricatorEnv::newObjectFromConfig('metamta.mail-adapter'); 525 523 526 - $defaults = $mailer->newDefaultOptions(); 527 - $options = $mailer->newLegacyOptions(); 524 + $adapters = PhabricatorMailImplementationAdapter::getAllAdapters(); 525 + $next_priority = -1; 528 526 529 - $options = $options + $defaults; 527 + foreach ($config as $spec) { 528 + $type = $spec['type']; 529 + if (!isset($adapters[$type])) { 530 + throw new Exception( 531 + pht( 532 + 'Unknown mailer ("%s")!', 533 + $type)); 534 + } 530 535 531 - $mailer 532 - ->setKey('default') 533 - ->setPriority(-1) 534 - ->setOptions($options); 536 + $key = $spec['key']; 537 + $mailer = id(clone $adapters[$type]) 538 + ->setKey($key); 535 539 536 - $mailers[] = $mailer; 537 - } else { 538 - $adapters = PhabricatorMailImplementationAdapter::getAllAdapters(); 539 - $next_priority = -1; 540 + $priority = idx($spec, 'priority'); 541 + if (!$priority) { 542 + $priority = $next_priority; 543 + $next_priority--; 544 + } 545 + $mailer->setPriority($priority); 540 546 541 - foreach ($config as $spec) { 542 - $type = $spec['type']; 543 - if (!isset($adapters[$type])) { 544 - throw new Exception( 545 - pht( 546 - 'Unknown mailer ("%s")!', 547 - $type)); 548 - } 549 - 550 - $key = $spec['key']; 551 - $mailer = id(clone $adapters[$type]) 552 - ->setKey($key); 553 - 554 - $priority = idx($spec, 'priority'); 555 - if (!$priority) { 556 - $priority = $next_priority; 557 - $next_priority--; 558 - } 559 - $mailer->setPriority($priority); 560 - 561 - $defaults = $mailer->newDefaultOptions(); 562 - $options = idx($spec, 'options', array()) + $defaults; 563 - $mailer->setOptions($options); 547 + $defaults = $mailer->newDefaultOptions(); 548 + $options = idx($spec, 'options', array()) + $defaults; 549 + $mailer->setOptions($options); 564 550 565 - $mailer->setSupportsInbound(idx($spec, 'inbound', true)); 566 - $mailer->setSupportsOutbound(idx($spec, 'outbound', true)); 551 + $mailer->setSupportsInbound(idx($spec, 'inbound', true)); 552 + $mailer->setSupportsOutbound(idx($spec, 'outbound', true)); 567 553 568 - $mailers[] = $mailer; 569 - } 554 + $mailers[] = $mailer; 570 555 } 571 556 572 557 // Remove mailers with the wrong types.
+1 -1
src/docs/user/configuration/configuration_locked.diviner
··· 82 82 attacker who has gained access to an administrator account in order to gain 83 83 greater access. 84 84 85 - For example, an attacker who could modify `metamta.mail-adapter` (and other 85 + For example, an attacker who could modify `cluster.mailers` (and other 86 86 similar options), could potentially reconfigure Phabricator to send mail 87 87 through an evil server they controlled, then trigger password resets on other 88 88 user accounts to compromise them.
+1 -1
src/docs/user/configuration/configuring_inbound_email.diviner
··· 129 129 - Add a Mailgun route with a `catch_all()` rule which takes the action 130 130 `forward("https://phabricator.example.com/mail/mailgun/")`. Replace the 131 131 example domain with your actual domain. 132 - - Set the `mailgun.api-key` config key to your Mailgun API key. 132 + - Configure a mailer in `cluster.mailers` with your Mailgun API key. 133 133 134 134 Postmark Setup 135 135 ==============