mailx change sender name
Asked Answered
J

4

6

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,

Jeffery answered 30/1, 2013 at 15:25 Comment(2)
what are you trying to achieve with -r?Mcabee
Change the sender's email. I think it works (-r) with newer version of mailxJeffery
E
2
mailx -a 'From:[email protected]' -s "Subject" [email protected] < text.txt
Ethiopian answered 14/10, 2015 at 15:0 Comment(0)
R
1

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.

Rattat answered 28/12, 2013 at 7:50 Comment(0)
A
1

Tested with this and found to be working:

echo test | mailx -s "Mail Test" [email protected] -- -f [email protected]

The double-dash before "-f" makes the mailx not to parse the -f, but only pass it to sendmail/postfix, which will then send with the "from" address mentioned.

Anzus answered 3/8, 2016 at 23:18 Comment(0)
H
1

You could try to use -a to add sender name in header:

mailx -a "From:Sender Name <[email protected]>" -s "some subject" [email protected]
Haematoxylin answered 22/10, 2021 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.