diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php --- a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php @@ -17,6 +17,12 @@ 'help' => 'Show details about outbound mail with given ID.', 'repeat' => true, ), + array( + 'name' => 'dump-html', + 'help' => pht( + 'Dump the HTML body of the mail. You can redirect it to a '. + 'file and then open it in a browser.'), + ), )); } @@ -45,6 +51,20 @@ $last_key = last_key($messages); foreach ($messages as $message_key => $message) { + if ($args->getArg('dump-html')) { + $html_body = $message->getHTMLBody(); + if (strlen($html_body)) { + $template = + "{$html_body}"; + $console->writeOut("%s\n", $html_body); + } else { + $console->writeErr( + "%s\n", + pht('(This message has no HTML body.)')); + } + continue; + } + $info = array(); $info[] = pht('PROPERTIES'); @@ -61,6 +81,10 @@ continue; } + if ($key == 'html-body') { + continue; + } + if ($key == 'headers') { continue; } @@ -110,8 +134,21 @@ } $info[] = null; - $info[] = pht('BODY'); - $info[] = $message->getBody(); + $info[] = pht('TEXT BODY'); + if (strlen($message->getBody())) { + $info[] = $message->getBody(); + } else { + $info[] = pht('(This message has no text body.)'); + } + + $info[] = null; + $info[] = pht('HTML BODY'); + if (strlen($message->getHTMLBody())) { + $info[] = $message->getHTMLBody(); + $info[] = null; + } else { + $info[] = pht('(This message has no HTML body.)'); + } $console->writeOut('%s', implode("\n", $info)); 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 @@ -221,6 +221,10 @@ return $this->getParam('body'); } + public function getHTMLBody() { + return $this->getParam('html-body'); + } + public function setIsErrorEmail($is_error) { $this->setParam('is-error', $is_error); return $this;