How to warn before sending email if "Subject:" is empty

Ed Blackman ed at edgewood.to
Tue Dec 28 22:42:33 UTC 2021


On Fri, Dec 24, 2021 at 05:18:57AM +0000, Sam Lee via Mutt-users wrote:
> Is it possible to make Mutt warn about an empty "Subject:" right before
> sending the email?
> 
> The `abort_nosubject` configuration variable is not relevant here
> because `abort_nosubject` is only for configuring what happens when
> there is no subject given at the subject prompt.
> 
> I am looking for something similar to `abort_noattach`'s
> "No attachments, cancel sending?" warning that appears right before
> email is sent. Is there something similar for warning about an empty
> "Subject:"?

I don't believe it's possible directly with Mutt configuration, but if you send via sendmail (instead of SMTP), you can do that with the sendmail command instead, replacing it with a script that checks the email it's about to send, and aborts with a message if it has an empty Subject: line.

I have a similar script that, among other things, checks that I actually have attachments when I have "attach" or "patch" in my body text.

If you send via SMTP, I don't think you can hook into send like that.  You could change your editor to a script that 1) calls the real editor then 2) checks for an empty Subject:.  That would not prevent you from removing it in Mutt compose window afterward, though.

-- 
Ed Blackman


More information about the Mutt-users mailing list