Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mailx change sender name

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,

like image 685
hudac Avatar asked Jan 30 '13 15:01

hudac


People also ask

How do I change the sender name in mailx?

Mailx command to include sender address I am using sender=server name(display name) echo "body" | mailx -s "subject" -b "bcc address" "to address" -- -f "$sender".

How do I change sender name in sendmail?

Re: Change sender name using sendmailmailx -r [email protected] -s "whatever" email_address. # If you wish to have mail appear to be from some host or location other than the loacl host, set macro M to the name you wish to masquerade as.

What is difference between mailx and mail?

The mailx utility is an enhanced version of the mail command. Along with the functionality provided by the original mail command, it provides extra features like the ability to send attachments by using the -a flag.


2 Answers

mailx -a 'From:[email protected]' -s "Subject" [email protected] < text.txt
like image 182
Timo Avatar answered Oct 18 '22 00:10

Timo


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.

like image 25
Nova Avatar answered Oct 18 '22 00:10

Nova