email - How to get `mail` on a CentOS 6 server (running postfix)

19
2014-04
  • warren

    On my old server, and most other devices I have run, there is a provided mail program.

    On my new CentOS 6 server, running postfix as the MTA, I cannot send command-line email via mail - the tool is not there.

    When running a yum whatprovides mail call, I get nothing helpful back:

    $ yum whatprovides mail
    Loaded plugins: fastestmirror
    Determining fastest mirrors
     * base: centos.kiewel-online.ch
     * extras: centos.kiewel-online.ch
     * updates: centos.kiewel-online.ch
    base                                                     | 3.7 kB     00:00
    base/primary_db                                          | 4.2 MB     00:00
    cr                                                       | 3.5 kB     00:00
    cr/primary_db                                            | 3.9 MB     00:00
    extras                                                   | 3.0 kB     00:00
    extras/primary_db                                        | 1.9 kB     00:00
    updates                                                  | 3.5 kB     00:00
    updates/primary_db                                       | 3.3 MB     00:00
    Warning: 3.0.x versions of yum would erroneously match against filenames.
     You can use "*/mail" and/or "*bin/mail" to get that behaviour
    No Matches found
    

    How is user-to-user mail supposed to be sent on CentOS 6?

  • Answers
  • Garrett

    In CentOS, this binary is provided by the mailx package:

    yum install mailx
    

    FYI, as the message at the bottom of your post indicates, you are using whatprovides incorrectly. Proper usage searching mirrors for a file called 'mail' would have been:

    yum whatprovides */mail
    

  • Related Question

    linux - How to install "mail"
  • teepusink

    I'm trying to install "mail" on a Red Hat 4.1.2-48 box. I tried:

    yum install mail
    

    It prints out:

    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.anl.gov
     * epel: mirror.steadfast.net
     * extras: centos.mirrors.tds.net
     * ius: mirror.rackspace.com
     * updates: yum.singlehop.com
    base                                                     | 1.1 kB     00:00     
    epel                                                     | 3.7 kB     00:00     
    extras                                                   | 2.1 kB     00:00     
    ius                                                      | 2.2 kB     00:00     
    updates                                                  | 1.9 kB     00:00     
    utterramblings                                           |  951 B     00:00     
    Setting up Install Process
    No package mail available.
    Nothing to do
    

    How can I work around this?


  • Related Answers
  • Vlad

    Perhaps you meant yum install mailx?

    You can test it sends emails using echo "Test" | mail [email protected]