How to specify the sender ("From") of an email with the mail command

The last reply to this post contains the answer. The mail command does not report any -r option if you run it with mail --help (neither does the manpage mention it), but it's there and works. It's a bit hidden and you've to apply it in a special way.

The syntax is something like this:
mail -s "subject" recipient@example.com -- -r "sender@example.com" -f /path/to/a/file
or
echo "This is the body." | mail -s "subject" recipient@example.com -- -r "sender@example.com"