Delete Mail Based on Subject Pattern [mail-command]

mail-command

Is it possible to delete all mail in which the subject matches a regex pattern?

For example, to delete message 1, you do:

d 1

But to delete all mail with subject starting with, say, [SPAM], I can't do:

d -s "^\[SPAM\].*$"

Best Answer

I am answering this in case anyone comes by the same question.

It does not appear there is any way to do bulk deletion by pattern matching using mail. An alternative is to use the mutt mail client, which does have such feature:

D \[SPAM\]

Thanks to @thrig and @dirkt for suggesting the alternative.

Related Question