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.
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.
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:
mailx -s "Subject" firstname.lastname@example.org -- -f email@example.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:
Originally Posted by mailx man page
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.