mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Add an optional configuration option to set 'Precedence: bulk' headers on
transactional mail Summary: See T571. SES refuses to deliver mail with this header and there are various reports of other issues on the internet so I'm defaulting it to off. Test Plan: Set config to true, tried to send mail, SES rejected it because of "Precedence: bulk" header. Reviewers: bmaurer, ola, jungejason, nh, aran Reviewed By: aran CC: aran, epriestley, bmaurer Differential Revision: 1032
This commit is contained in:
parent
661f077bf7
commit
4156cf6bd9
6 changed files with 38 additions and 0 deletions
|
@ -279,6 +279,15 @@ return array(
|
|||
// address will be stored in an 'From Email' field on the task.
|
||||
'metamta.maniphest.default-public-author' => null,
|
||||
|
||||
// If this option is enabled, Phabricator will add a "Precedence: bulk"
|
||||
// header to transactional mail (e.g., Differential, Maniphest and Herald
|
||||
// notifications). This may improve the behavior of some auto-responder
|
||||
// software and prevent it from replying. However, it may also cause
|
||||
// deliverability issues -- notably, you currently can not send this header
|
||||
// via Amazon SES, and enabling this option with SES will prevent delivery
|
||||
// of any affected mail.
|
||||
'metamta.precedence-bulk' => false,
|
||||
|
||||
|
||||
// -- Auth ------------------------------------------------------------------ //
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ abstract class DifferentialMail {
|
|||
$template->addHeader('X-Herald-Rules', $this->heraldRulesHeader);
|
||||
}
|
||||
|
||||
$template->setIsBulk(true);
|
||||
$template->setRelatedPHID($this->getRevision()->getPHID());
|
||||
|
||||
$phids = array();
|
||||
|
|
|
@ -254,6 +254,7 @@ class ManiphestTransactionEditor {
|
|||
->addHeader('Thread-Topic', 'Maniphest Task '.$task->getID())
|
||||
->setThreadID($thread_id, $is_create)
|
||||
->setRelatedPHID($task->getPHID())
|
||||
->setIsBulk(true)
|
||||
->setBody($body);
|
||||
|
||||
$mails = $reply_handler->multiplexMail(
|
||||
|
|
|
@ -32,6 +32,7 @@ class PhabricatorMetaMTASendController extends PhabricatorMetaMTAController {
|
|||
$mail->setFrom($request->getUser()->getPHID());
|
||||
$mail->setSimulatedFailureCount($request->getInt('failures'));
|
||||
$mail->setIsHTML($request->getInt('html'));
|
||||
$mail->setIsBulk($request->getInt('bulk'));
|
||||
$mail->save();
|
||||
if ($request->getInt('immediately')) {
|
||||
$mail->sendNow();
|
||||
|
@ -110,6 +111,10 @@ class PhabricatorMetaMTASendController extends PhabricatorMetaMTAController {
|
|||
id(new AphrontFormCheckboxControl())
|
||||
->setLabel('HTML')
|
||||
->addCheckbox('html', '1', 'Send as HTML email.'))
|
||||
->appendChild(
|
||||
id(new AphrontFormCheckboxControl())
|
||||
->setLabel('Bulk')
|
||||
->addCheckbox('bulk', '1', 'Send with bulk email headers.'))
|
||||
->appendChild(
|
||||
id(new AphrontFormCheckboxControl())
|
||||
->setLabel('Send Now')
|
||||
|
|
|
@ -151,6 +151,20 @@ class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag that this is an auto-generated bulk message and should have bulk
|
||||
* headers added to it if appropriate. Broadly, this means some flavor of
|
||||
* "Precedence: bulk" or similar, but is implementation and configuration
|
||||
* dependent.
|
||||
*
|
||||
* @param bool True if the mail is automated bulk mail.
|
||||
* @return this
|
||||
*/
|
||||
public function setIsBulk($is_bulk) {
|
||||
$this->setParam('is-bulk', $is_bulk);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to set an ID used for message threading. MetaMTA will
|
||||
* set appropriate headers (Message-ID, In-Reply-To, References and
|
||||
|
@ -315,6 +329,13 @@ class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
|||
$mailer->setIsHTML(true);
|
||||
}
|
||||
break;
|
||||
case 'is-bulk':
|
||||
if ($value) {
|
||||
if (PhabricatorEnv::getEnvConfig('metamta.precedence-bulk')) {
|
||||
$mailer->addHeader('Precedence', 'bulk');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'thread-id':
|
||||
if ($is_first && $mailer->supportsMessageIDHeader()) {
|
||||
$mailer->addHeader('Message-ID', $value);
|
||||
|
|
|
@ -127,6 +127,7 @@ EOBODY;
|
|||
$mailer->addTos($email_phids);
|
||||
$mailer->setSubject($subject);
|
||||
$mailer->setBody($body);
|
||||
$mailer->setIsBulk(true);
|
||||
|
||||
$mailer->addHeader('X-Herald-Rules', $xscript->getXHeraldRulesHeader());
|
||||
if ($author_phid) {
|
||||
|
|
Loading…
Reference in a new issue