This question already has an answer here:
- Mail vs. mail what is the difference 2 answers
Whats the difference between mail and mailx?
I'm trying to troubleshoot a problem where I can send mail from server A with this
echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS command but executing the same command from server B throws me this error (Both servers are RHEL)
mail: 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]
Now... going through mail manpages to ty to understand whats happening,
man mail gives me this:
In Server A
MAILX(1) User Commands MAILX(1) NAME mailx - send and receive Internet mail SYNOPSIS mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . . mailx [-BDdeEHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f [name] mailx [-BDdeEinNRv~] [-A account] [-S variable[=value]] [-u user]
But in server B
MAIL(1) BSD General Commands Manual MAIL(1) NAME mail - send and receive mail SYNOPSIS mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr... [-- sendmail-options...] mail [-iInNv] -f [name] mail [-iInNv] [-u user]
Now... if I try
man mailx in server B I get:
MAILX(P) POSIX Programmerâs Manual MAILX(P) PROLOG This manual page is part of the POSIX Programmerâs Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be imple- mented on Linux. NAME mailx - process messages SYNOPSIS Send Mode mailx [-s subject] address... Receive Mode mailx -e mailx [-HiNn][-F][-u user] mailx -f[-HiNn][-F][file]
Server B has a different version of mail than Server A? Mailx and Mail are different things? I would like to use the -r option I use in server A but in server B and I don't really know whats happening.