Problems sending mail: 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)
    
    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.

The -r option is not portable. Maybe on purpose because it's ideal for a spammer.
The default is the user who sends the mail, and the administrator put some rules to generate a sender address out of it. (And that's not safe against a professional spammer either.)
I like the old Unix mail or sendmail tools that do not even know a -s option, and you have to construct the mail header in SMTP style:

echo "\
Subject: $SUBJECT 
From: $FROM

$MESSAGE
" | mail $RECIPIENTS

NB an empty line indicates the end of the header section.
You can still try that with your advanced mail and mailx programs...