mailx change sender name

hudac picture hudac · Jan 30, 2013 · Viewed 15.4k times · Source

I understood that for changing sender's name with mailx I should do the following:

mailx -r [email protected] -s "some subject" [email protected]

But when I do that, 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 knows what's happening? thanks,

Answer

Nova S. picture Nova S. · Dec 28, 2013

The correct syntax is:

mailx -s "some subject" [email protected] -- -r [email protected]

The Usage info shows "[-- sendmail-options ...]" and since "-r" is a sendmail option, you need to use the double dashes first.