Page MenuHomePhabricator

D19942.id47606.diff
No OneTemporary

D19942.id47606.diff

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 minificatino 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(<<<EODOC
-When sending a message that has no To recipient (i.e. all recipients are CC'd),
-set the To field to the following value. If no value is set, messages with no
-To will have their CCs upgraded to To.
-EODOC
));
$public_replies_description = $this->deformat(pht(<<<EODOC
@@ -203,11 +196,6 @@
'string',
'noreply@phabricator.example.com')
->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 "<string@domain.tld>"; 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.

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 3:42 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288324
Default Alt Text
D19942.id47606.diff (5 KB)

Event Timeline