@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.

Make HTML email a little easier to debug

Summary:
Ref T992.

- Format text/HTML bodies explicitly in `bin/mail show-outbound`.
- Provide `bin/mail show-outbound --dump-html` so you can do something like `bin/mail show-outbound --dump-html > dump.html; open dump.html` to get a browser preview somewhat easily.

Test Plan: Ran `bin/mail show-outbound` with and without `--dump-html` flag.

Reviewers: talshiri, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T992

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

+43 -2
+39 -2
src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
··· 17 17 'help' => 'Show details about outbound mail with given ID.', 18 18 'repeat' => true, 19 19 ), 20 + array( 21 + 'name' => 'dump-html', 22 + 'help' => pht( 23 + 'Dump the HTML body of the mail. You can redirect it to a '. 24 + 'file and then open it in a browser.'), 25 + ), 20 26 )); 21 27 } 22 28 ··· 45 51 46 52 $last_key = last_key($messages); 47 53 foreach ($messages as $message_key => $message) { 54 + if ($args->getArg('dump-html')) { 55 + $html_body = $message->getHTMLBody(); 56 + if (strlen($html_body)) { 57 + $template = 58 + "<!doctype html><html><body>{$html_body}</body></html>"; 59 + $console->writeOut("%s\n", $html_body); 60 + } else { 61 + $console->writeErr( 62 + "%s\n", 63 + pht('(This message has no HTML body.)')); 64 + } 65 + continue; 66 + } 67 + 48 68 $info = array(); 49 69 50 70 $info[] = pht('PROPERTIES'); ··· 61 81 continue; 62 82 } 63 83 84 + if ($key == 'html-body') { 85 + continue; 86 + } 87 + 64 88 if ($key == 'headers') { 65 89 continue; 66 90 } ··· 110 134 } 111 135 112 136 $info[] = null; 113 - $info[] = pht('BODY'); 114 - $info[] = $message->getBody(); 137 + $info[] = pht('TEXT BODY'); 138 + if (strlen($message->getBody())) { 139 + $info[] = $message->getBody(); 140 + } else { 141 + $info[] = pht('(This message has no text body.)'); 142 + } 143 + 144 + $info[] = null; 145 + $info[] = pht('HTML BODY'); 146 + if (strlen($message->getHTMLBody())) { 147 + $info[] = $message->getHTMLBody(); 148 + $info[] = null; 149 + } else { 150 + $info[] = pht('(This message has no HTML body.)'); 151 + } 115 152 116 153 $console->writeOut('%s', implode("\n", $info)); 117 154
+4
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 221 221 return $this->getParam('body'); 222 222 } 223 223 224 + public function getHTMLBody() { 225 + return $this->getParam('html-body'); 226 + } 227 + 224 228 public function setIsErrorEmail($is_error) { 225 229 $this->setParam('is-error', $is_error); 226 230 return $this;