3 final class PhabricatorMailManagementListOutboundWorkflow
4 extends PhabricatorMailManagementWorkflow
{
6 protected function didConstruct() {
8 ->setName('list-outbound')
9 ->setSynopsis(pht('List outbound messages.'))
10 ->setExamples('**list-outbound**')
18 'Show a specific number of messages (default 100).'),
23 public function execute(PhutilArgumentParser
$args) {
24 $console = PhutilConsole
::getConsole();
25 $viewer = $this->getViewer();
27 $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
28 '1 = 1 ORDER BY id DESC LIMIT %d',
29 $args->getArg('limit'));
32 $console->writeErr("%s\n", pht('No sent mail.'));
36 $table = id(new PhutilConsoleTable())
37 ->setShowHeader(false)
38 ->addColumn('id', array('title' => pht('ID')))
39 ->addColumn('encrypt', array('title' => pht('#')))
40 ->addColumn('status', array('title' => pht('Status')))
41 ->addColumn('type', array('title' => pht('Type')))
42 ->addColumn('subject', array('title' => pht('Subject')));
44 foreach (array_reverse($mails) as $mail) {
45 $status = $mail->getStatus();
48 'id' => $mail->getID(),
49 'encrypt' => ($mail->getMustEncrypt() ?
'#' : ' '),
50 'status' => PhabricatorMailOutboundStatus
::getStatusName($status),
51 'type' => $mail->getMessageType(),
52 'subject' => $mail->getSubject(),