diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -380,6 +380,11 @@ 'Resource deflation is now managed automatically.'), 'celerity.minify' => pht( 'Resource minification is now managed automatically.'), + + 'metamta.domain' => pht( + 'Mail thread IDs are now generated automatically.'), + 'metamta.placeholder-to-recipient' => pht( + 'Placeholder recipients are now generated automatically.'), ); return $ancient_config; diff --git a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php --- a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php +++ b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php @@ -139,13 +139,6 @@ great. A number of other mailers are available (e.g., SES, SendGrid, SMTP, custom mailers). This option is deprecated in favor of 'cluster.mailers'. EODOC -)); - - $placeholder_description = $this->deformat(pht(<<deformat(pht(<<setDescription(pht('Default "From" address.')), - $this->newOption( - 'metamta.domain', - 'string', - 'phabricator.example.com') - ->setDescription(pht('Domain used to generate Message-IDs.')), $this->newOption( 'metamta.one-mail-per-recipient', 'bool', @@ -265,9 +253,6 @@ )) ->setSummary(pht('Trust "Reply-To" headers for authentication.')) ->setDescription($reply_to_description), - $this->newOption('metamta.placeholder-to-recipient', 'string', null) - ->setSummary(pht('Placeholder for mail with only CCs.')) - ->setDescription($placeholder_description), $this->newOption('metamta.public-replies', 'bool', false) ->setBoolOptions( array( diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -857,7 +857,7 @@ // aren't in the form ""; this is also required // by RFC 2822, although some clients are more liberal in what they // accept. - $domain = PhabricatorEnv::getEnvConfig('metamta.domain'); + $domain = $this->newMailDomain(); $value = '<'.$value.'@'.$domain.'>'; if ($is_first && $mailer->supportsMessageIDHeader()) { @@ -1017,18 +1017,13 @@ return null; } - // Some mailers require a valid "To:" in order to deliver mail. If we - // don't have any "To:", try to fill it in with a placeholder "To:". - // If that also fails, move the "Cc:" line to "To:". + // Some mailers require a valid "To:" in order to deliver mail. If we don't + // have any "To:", fill it in with a placeholder "To:". This allows client + // rules based on whether the recipient is in "To:" or "CC:" to continue + // behaving in the same way. if (!$add_to) { - $placeholder_key = 'metamta.placeholder-to-recipient'; - $placeholder = PhabricatorEnv::getEnvConfig($placeholder_key); - if ($placeholder !== null) { - $add_to = array($placeholder); - } else { - $add_to = $add_cc; - $add_cc = array(); - } + $void_recipient = $this->newVoidEmailAddress(); + $add_to = array($void_recipient->getAddress()); } $add_to = array_unique($add_to); @@ -1467,6 +1462,19 @@ return '/mail/detail/'.$this->getID().'/'; } + private function newMailDomain() { + $install_uri = PhabricatorEnv::getURI('/'); + $install_uri = new PhutilURI($install_uri); + + return $install_uri->getDomain(); + } + + public function newVoidEmailAddress() { + $domain = $this->newMailDomain(); + $address = "void-recipient@{$domain}"; + return new PhutilEmailAddress($address); + } + /* -( Routing )------------------------------------------------------------ */ 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 @@ -45,7 +45,6 @@ - **metamta.default-address** determines where mail is sent "From" by default. If your domain is `example.org`, set this to something like `noreply@example.org`. - - **metamta.domain** should be set to your domain, e.g. `example.org`. - **metamta.can-send-as-user** should be left as `false` in most cases, but see the documentation for details.