Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | if ($ex instanceof PhabricatorMetaMTAReceivedMailProcessingException) { | ||||
$title = pht('Error Processing Mail (%s)', $status_name); | $title = pht('Error Processing Mail (%s)', $status_name); | ||||
$description = $ex->getMessage(); | $description = $ex->getMessage(); | ||||
} else { | } else { | ||||
$title = pht('Error Processing Mail (%s)', get_class($ex)); | $title = pht('Error Processing Mail (%s)', get_class($ex)); | ||||
$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: | ||||
%s | %s | ||||
-- Original Message Body ----------------------------------------------------- | -- Original Message Body ----------------------------------------------------- | ||||
%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) | ||||
->setSubject($title) | ->setSubject($title) | ||||
->addRawTos(array($from)) | ->addRawTos(array($from)) | ||||
->setBody($body) | ->setBody($body) | ||||
->saveAndSend(); | ->saveAndSend(); | ||||
} | } | ||||
} | } |