summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-03-27 19:14:10 -0700
committerKevin McCarthy <kevin@8t8.us>2021-03-27 19:14:10 -0700
commit4e01ccdb15ca1941e9b91d5e5ca7cb827bfe0f6d (patch)
treea0ed76768966fa794ead40b0a012deed47de2a27 /main.c
parent8ac730a1df03191eca727683cd9454f0a95bd752 (diff)
Stop batch mode emails with no argument or recipients.
Closes #345. There are checks in send.c to guard against a no-recipient email being sent, but there might be a my_hdr or other setting in the muttrc. In that case, it would be surprising for an email to be sent.
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main.c b/main.c
index 852874e1..329db223 100644
--- a/main.c
+++ b/main.c
@@ -957,8 +957,8 @@ int main (int argc, char **argv, char **environ)
mutt_flushinp ();
mutt_send_message (SENDPOSTPONED, NULL, NULL, NULL, NULL);
}
- else if (subject || msg || sendflags || draftFile || includeFile || attach ||
- optind < argc)
+ else if (subject || msg || (sendflags & SENDMAILX) || draftFile ||
+ includeFile || attach || optind < argc)
{
FILE *fin = NULL;
FILE *fout = NULL;
@@ -1280,6 +1280,14 @@ int main (int argc, char **argv, char **environ)
if (rv)
goto cleanup_and_exit;
}
+ /* This guards against invoking `mutt < /dev/null` and accidentally
+ * sending an email due to a my_hdr or other setting.
+ */
+ else if (sendflags & SENDBATCH)
+ {
+ fputs (_("No recipients specified.\n"), stderr);
+ goto cleanup_and_exit;
+ }
else
{
if (!folder)