Sending mail from command line only if body not empty

-E

If an outgoing message does not contain any text in its first or only message part, do not send it but discard it silently, effectively setting the skipemptybody variable at program startup. This is useful for sending messages from scripts started by cron(8).

The bsd-mailx and heirloom-mailx packages both provide a mailx with the -E option.

GNU mailtools don't have this option.

Popular posts from this blog

How to delete / clear queue of PowerMTA