diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-03-27 19:14:10 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-03-27 19:14:10 -0700 |
commit | 4e01ccdb15ca1941e9b91d5e5ca7cb827bfe0f6d (patch) | |
tree | a0ed76768966fa794ead40b0a012deed47de2a27 /main.c | |
parent | 8ac730a1df03191eca727683cd9454f0a95bd752 (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.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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) |