2 The question is not about email/MTA server named "Sendmail"
| link
    Post Closed as "duplicate" by Gilles, jasonwryan, slm, Mat, phunehehe of
    Post Migrated Here from serverfault.com
source | link

Difference between mail and mailx?

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)

       mailx - send and receive Internet mail

       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)

     mail - send and receive mail

     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)

       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.

       mailx - process messages

   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.