Skip to content

Commit 7d31ea7

Browse files
author
epriestley
committed
Minor tweaks to bin/mail send-test
Summary: Clean up some arg handling stuff. Test Plan: Used this while debugging. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D10314
1 parent f50ba4f commit 7d31ea7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ public function execute(PhutilArgumentParser $args) {
7979
$tos = $args->getArg('to');
8080
$ccs = $args->getArg('cc');
8181

82+
if (!$tos && !$ccs) {
83+
throw new PhutilArgumentUsageException(
84+
pht(
85+
'Specify one or more users to send mail to with `--to` and '.
86+
'`--cc`.'));
87+
}
88+
8289
$names = array_merge($tos, $ccs);
8390
$users = id(new PhabricatorPeopleQuery())
8491
->setViewer($viewer)
@@ -103,14 +110,17 @@ public function execute(PhutilArgumentParser $args) {
103110
}
104111

105112
$subject = $args->getArg('subject');
113+
if ($subject === null) {
114+
$subject = pht('No Subject');
115+
}
116+
106117
$tags = $args->getArg('tag');
107118
$attach = $args->getArg('attach');
108119
$is_bulk = $args->getArg('bulk');
109120

110121
$console->writeErr("%s\n", pht('Reading message body from stdin...'));
111122
$body = file_get_contents('php://stdin');
112123

113-
114124
$mail = id(new PhabricatorMetaMTAMail())
115125
->addTos($tos)
116126
->addCCs($ccs)

0 commit comments

Comments
 (0)