1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Add original mail headers to the bottom of error mail

Summary: From IRC, this is sometimes helpful for debugging if there's a mailing list issue or something like that. For example, it can show "To" and "Cc".

Test Plan: Got some email, saw headers in it.

Reviewers: dctrwatson, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8708
This commit is contained in:
epriestley 2014-04-06 07:57:03 -07:00
parent 3b33089de7
commit b03912213f

View file

@ -297,6 +297,16 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
$description = pht('%s: %s', get_class($ex), $ex->getMessage()); $description = pht('%s: %s', get_class($ex), $ex->getMessage());
} }
// TODO: Since headers don't necessarily have unique names, this may not
// really be all the headers. It would be nice to pass the raw headers
// through from the upper layers where possible.
$headers = array();
foreach ($this->headers as $key => $value) {
$headers[] = pht('%s: %s', $key, $value);
}
$headers = implode("\n", $headers);
$body = pht(<<<EOBODY $body = pht(<<<EOBODY
Your email to Phabricator was not processed, because an error occurred while Your email to Phabricator was not processed, because an error occurred while
trying to handle it: trying to handle it:
@ -307,10 +317,15 @@ trying to handle it:
%s %s
-- Original Message Headers --------------------------------------------------
%s
EOBODY EOBODY
, ,
wordwrap($description, 78), wordwrap($description, 78),
$this->getRawTextBody()); $this->getRawTextBody(),
$headers);
$mail = id(new PhabricatorMetaMTAMail()) $mail = id(new PhabricatorMetaMTAMail())
->setIsErrorEmail(true) ->setIsErrorEmail(true)