Mailx change sender name

I realized that in order to change the sender name using, mailxI have to do the following:

mailx -r newmail@mail.com -s "some subject" my@email.com

But when I do this, I get:

mailx: invalid option -- r
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
            [-- sendmail-options ...]
       mail [-iInNv] -f [name]
       mail [-iInNv] [-u user

Does anyone know what is going on? thank,

+5
source share
3 answers

The correct syntax is:

mailx -s "some subject" my@email.com -- -r newmail@mail.com

Usage information shows "[- sendmail-options ...]", and since "-r" is a sendmail option, you need to use double hyphens first.

+1
source
mailx -a 'From:name@your-domain.com' -s "Subject" my-best-friend@other-domain.com < text.txt
+1
source

, :

- | mailx -s "Mail Test" user@recipentdomain.com - -f user@senderdomain.com

The double dash before "-f" causes mailx not to parse -f, but only sendmail / postfix, which is then sent with the specified "from" address.

+1
source

All Articles