Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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,
Yep...that option hasn't been supported for some time now. The mailx documentation is thorough, but complex. You've got a couple of options:
Something like
Code:
mailx -s "Subject" user@domain.com -- -f from@domain.com < body
The double-dash tells mailx not to parse the -f, but just pass it along to sendmail/postfix, which will then set the "from" address accordingly
The -a switch, which supplies additional headersy, supplying a From: header on the command line that will be appended to the outgoing mail. In conjunction with the $REPLYTO environment variable specifies a Reply-To: header:
Hate to disagree with you, but mailx on my Centos 6.3 supports it (-r ) fully. Its both in the man page and it works; just tested it to be sure...
Huh...I had read it wasn't supported, and it doesn't work for me on my system. However, from the man page:
Quote:
Originally Posted by mailx man page
-r address
Sets the From address. Overrides any from variable specified in environment or startup files.
Tilde escapes are disabled. The -r address options are passed to the mail transfer agent
unless SMTP is used. This option exists for compatibility only; it is recommended to set the from
variable directly instead.
The bolded part is what caught my eye. I'm puzzled though, since the man page DOES mention the "-r" being a valid option, but it does note it's only there for compatibility.
Well, your profile says RHEL+Centos; try it on one of those?
Yep...tried it on an RHEL6 server, and it didn't work, which is why I'm puzzled. Is the mailx executable on your box a link, or the actual mailx program?? I've seen links to "mail" from "mailx" before...but just grasping at straws here.
which mailx
/bin/mailx
ll /bin/mailx
-rwxr-xr-x. 1 root root 391224 Aug 22 2010 /bin/mailx
Would I lie to you
Hey, I cast no dispersions your way! Was just trying to thing why it would behave differently. For me:
ll /usr/bin/mailx
-rwxr-xr-x 1 root root 361048 Feb 22 2011 /usr/bin/mailx
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.