@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 "metamta.domain" and "metamta.placeholder-to-recipient" config options

Summary:
Ref T920. This simplifies mail configuration.

The "metamta.domain" option is only used to generate Thread-ID values, and we just need something that looks like a bit like a domain in order to make GMail happy. Just use the install domain. In most cases, this is almost certainly the configured value anyway. In some cases, this may cause a one-time threading break for existing threads; I'll call this out in the changelog.

The "metamta.placeholder-to-recipient" is used to put some null value in "To:" when a mail only has CCs. This is so that if you write a local client mail rule like "when I'm in CC, burn the message in a fire" it works even if all the "to" addresses have elected not to receive the mail. Instead: just send it to an unlikely address at our own domain.

I'll add some additional handling for the possiblity that we may receive this email ourselves in the next change, but it overlaps with T7477.

Test Plan: Grepped for these configuration values.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T920

Differential Revision: https://secure.phabricator.com/D19942

+25 -28
+5
src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
··· 380 380 'Resource deflation is now managed automatically.'), 381 381 'celerity.minify' => pht( 382 382 'Resource minification is now managed automatically.'), 383 + 384 + 'metamta.domain' => pht( 385 + 'Mail thread IDs are now generated automatically.'), 386 + 'metamta.placeholder-to-recipient' => pht( 387 + 'Placeholder recipients are now generated automatically.'), 383 388 ); 384 389 385 390 return $ancient_config;
-15
src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
··· 141 141 EODOC 142 142 )); 143 143 144 - $placeholder_description = $this->deformat(pht(<<<EODOC 145 - When sending a message that has no To recipient (i.e. all recipients are CC'd), 146 - set the To field to the following value. If no value is set, messages with no 147 - To will have their CCs upgraded to To. 148 - EODOC 149 - )); 150 - 151 144 $public_replies_description = $this->deformat(pht(<<<EODOC 152 145 By default, Phabricator generates unique reply-to addresses and sends a separate 153 146 email to each recipient when you enable reply handling. This is more secure than ··· 204 197 'noreply@phabricator.example.com') 205 198 ->setDescription(pht('Default "From" address.')), 206 199 $this->newOption( 207 - 'metamta.domain', 208 - 'string', 209 - 'phabricator.example.com') 210 - ->setDescription(pht('Domain used to generate Message-IDs.')), 211 - $this->newOption( 212 200 'metamta.one-mail-per-recipient', 213 201 'bool', 214 202 true) ··· 265 253 )) 266 254 ->setSummary(pht('Trust "Reply-To" headers for authentication.')) 267 255 ->setDescription($reply_to_description), 268 - $this->newOption('metamta.placeholder-to-recipient', 'string', null) 269 - ->setSummary(pht('Placeholder for mail with only CCs.')) 270 - ->setDescription($placeholder_description), 271 256 $this->newOption('metamta.public-replies', 'bool', false) 272 257 ->setBoolOptions( 273 258 array(
+20 -12
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 857 857 // aren't in the form "<string@domain.tld>"; this is also required 858 858 // by RFC 2822, although some clients are more liberal in what they 859 859 // accept. 860 - $domain = PhabricatorEnv::getEnvConfig('metamta.domain'); 860 + $domain = $this->newMailDomain(); 861 861 $value = '<'.$value.'@'.$domain.'>'; 862 862 863 863 if ($is_first && $mailer->supportsMessageIDHeader()) { ··· 1017 1017 return null; 1018 1018 } 1019 1019 1020 - // Some mailers require a valid "To:" in order to deliver mail. If we 1021 - // don't have any "To:", try to fill it in with a placeholder "To:". 1022 - // If that also fails, move the "Cc:" line to "To:". 1020 + // Some mailers require a valid "To:" in order to deliver mail. If we don't 1021 + // have any "To:", fill it in with a placeholder "To:". This allows client 1022 + // rules based on whether the recipient is in "To:" or "CC:" to continue 1023 + // behaving in the same way. 1023 1024 if (!$add_to) { 1024 - $placeholder_key = 'metamta.placeholder-to-recipient'; 1025 - $placeholder = PhabricatorEnv::getEnvConfig($placeholder_key); 1026 - if ($placeholder !== null) { 1027 - $add_to = array($placeholder); 1028 - } else { 1029 - $add_to = $add_cc; 1030 - $add_cc = array(); 1031 - } 1025 + $void_recipient = $this->newVoidEmailAddress(); 1026 + $add_to = array($void_recipient->getAddress()); 1032 1027 } 1033 1028 1034 1029 $add_to = array_unique($add_to); ··· 1465 1460 1466 1461 public function getURI() { 1467 1462 return '/mail/detail/'.$this->getID().'/'; 1463 + } 1464 + 1465 + private function newMailDomain() { 1466 + $install_uri = PhabricatorEnv::getURI('/'); 1467 + $install_uri = new PhutilURI($install_uri); 1468 + 1469 + return $install_uri->getDomain(); 1470 + } 1471 + 1472 + public function newVoidEmailAddress() { 1473 + $domain = $this->newMailDomain(); 1474 + $address = "void-recipient@{$domain}"; 1475 + return new PhutilEmailAddress($address); 1468 1476 } 1469 1477 1470 1478
-1
src/docs/user/configuration/configuring_outbound_email.diviner
··· 45 45 - **metamta.default-address** determines where mail is sent "From" by 46 46 default. If your domain is `example.org`, set this to something like 47 47 `noreply@example.org`. 48 - - **metamta.domain** should be set to your domain, e.g. `example.org`. 49 48 - **metamta.can-send-as-user** should be left as `false` in most cases, 50 49 but see the documentation for details. 51 50