HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Mailx Doubt RHEL
Operating System - Linux
1829229
Members
2320
Online
109987
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2009 03:40 AM
11-04-2009 03:40 AM
Mailx Doubt RHEL
Hi we have a new Linux server with RHEL 4. Previously in HP UX we used -r option to sned mails via script to specify a from address. In Linux we dont have the -r option now can any one please help?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2009 05:34 AM
11-04-2009 05:34 AM
Re: Mailx Doubt RHEL
Shalom,
You con't even really have mailx. The command on Linux is mail but the man page is different.
I think you need to RTFM here but -s or -u looks good to me.
SEP
You con't even really have mailx. The command on Linux is mail but the man page is different.
I think you need to RTFM here but -s or -u looks good to me.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2009 07:16 AM
11-04-2009 07:16 AM
Re: Mailx Doubt RHEL
Hi vinay,
that's true for RHEL's mail(x) command.
Btw, on my RHEL 5 boxes mailx is simply a symlink to mail, so you ought to be able to use the command name that you prefer (or rather may have carried over from scripts for other Unices).
There are several workarounds to forge the SMTP envelope's Return-path, even when using the mail(x) version without the -r option.
If you studied the manpage of mail(x) on you RHEL you may probably have noticed that you can pass additional sendmail options to the mail(x) command if they follow a double hyphen (i.e. all following that is regarded to be passed to the underlying sendmail).
That's fine since sendmail knows of the -f option (see man sendmail) by which you can specify a deviating Return-path address.
However, there is a little grain of salt,
if the invoker is any non-privileged user (viz. !root) and is not the same as that stated in the forged From address then sendmail will add an X-Authentication-Warning to your mails header.
Nevertheless, here's is how it should work.
$ echo "something to fill the body" | mail -s "any subject you like" recipient@their-maildomain.tld -- -fsender@other-than-login.tld
Besides this way, some claim that often a set environment variable of SENDER should also do the trick.
However, that hasn't worked for me.
Sould it work though, the invocation should be something like
$ echo "something to fill the body" | SENDER=sender@other-than-login.tld mail -s "any subject you like" recipient@their-maildomain.tld
Alternatively, you could avoid the usage of mail(x) altogether and script your own SMTP client (e.g. Perl's Net::SMTP or Mail::Mailer etc.)
Or you pipe your message directly into sendmail like
e.g.
printf "From: %s\nSubject: %s\n\n" $(id -nu)@$(hostname) "any subject you like" "something to fill the body" | /usr/sbin/sendmail -ODeliveryMode=b -fsender@other-than-login.tld recipient@their-maildomain.tld
Instead of using printf you could also use a here-file sort of "redirection" to keep the command lines shorter.
that's true for RHEL's mail(x) command.
Btw, on my RHEL 5 boxes mailx is simply a symlink to mail, so you ought to be able to use the command name that you prefer (or rather may have carried over from scripts for other Unices).
There are several workarounds to forge the SMTP envelope's Return-path, even when using the mail(x) version without the -r option.
If you studied the manpage of mail(x) on you RHEL you may probably have noticed that you can pass additional sendmail options to the mail(x) command if they follow a double hyphen (i.e. all following that is regarded to be passed to the underlying sendmail).
That's fine since sendmail knows of the -f option (see man sendmail) by which you can specify a deviating Return-path address.
However, there is a little grain of salt,
if the invoker is any non-privileged user (viz. !root) and is not the same as that stated in the forged From address then sendmail will add an X-Authentication-Warning to your mails header.
Nevertheless, here's is how it should work.
$ echo "something to fill the body" | mail -s "any subject you like" recipient@their-maildomain.tld -- -fsender@other-than-login.tld
Besides this way, some claim that often a set environment variable of SENDER should also do the trick.
However, that hasn't worked for me.
Sould it work though, the invocation should be something like
$ echo "something to fill the body" | SENDER=sender@other-than-login.tld mail -s "any subject you like" recipient@their-maildomain.tld
Alternatively, you could avoid the usage of mail(x) altogether and script your own SMTP client (e.g. Perl's Net::SMTP or Mail::Mailer etc.)
Or you pipe your message directly into sendmail like
e.g.
printf "From: %s\nSubject: %s\n\n" $(id -nu)@$(hostname) "any subject you like" "something to fill the body" | /usr/sbin/sendmail -ODeliveryMode=b -fsender@other-than-login.tld recipient@their-maildomain.tld
Instead of using printf you could also use a here-file sort of "redirection" to keep the command lines shorter.
Madness, thy name is system administration
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP