3 final class PhabricatorMailManagementResendWorkflow
4 extends PhabricatorMailManagementWorkflow
{
6 protected function didConstruct() {
9 ->setSynopsis(pht('Send mail again.'))
11 '**resend** --id 1 --id 2')
17 'help' => pht('Send mail with a given ID again.'),
23 public function execute(PhutilArgumentParser
$args) {
24 $console = PhutilConsole
::getConsole();
26 $ids = $args->getArg('id');
28 throw new PhutilArgumentUsageException(
30 "Use the '%s' flag to specify one or more messages to resend.",
34 $messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(
39 $ids = array_fuse($ids);
40 $missing = array_diff_key($ids, $messages);
42 throw new PhutilArgumentUsageException(
44 'Some specified messages do not exist: %s',
45 implode(', ', array_keys($missing))));
49 foreach ($messages as $message) {
50 $message->setStatus(PhabricatorMailOutboundStatus
::STATUS_QUEUE
);
53 $mailer_task = PhabricatorWorker
::scheduleTask(
54 'PhabricatorMetaMTAWorker',
57 'priority' => PhabricatorWorker
::PRIORITY_ALERTS
,
63 'Queued message #%d for resend.',