Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've had a look on Google and the man pages for mail, but I can't figure out how to set it up. All I want to do is set up my email address so that I can send email via the terminal. How do I do that?

share|improve this question

Traditionally, Unix mail programs, including mail, rely on a MTA (Mail Transfer Agent) to do the actual transmission. For personal use, msmtp will be easiest to set up – it can only send mail, not receive, and allows user-specific configuration.

Install msmtp, then add your Gmail account into ~/.msmtprc:

    tls on
    # the path below may need to be adjusted
    tls_trust_file /etc/ssl/certs/ca-certificates.crt

account gmail
    port 587
    auth plain

account default : gmail

Now tell mail to use msmtp, by editing ~/.mailrc:

set sendmail="/usr/bin/msmtp"

(If this does not work, run ln -s /usr/bin/msmtp /usr/sbin/sendmail as root.)

Finally, if you want mail/msmtp to remember your Gmail password, it goes to ~/.netrc:

    password "your password here"
share|improve this answer

Unless your system admin has already set up the mail system, you must configure a Mail Transfer Agent. That is sendmail traditionally, modern systems use postfix or exim4.

share|improve this answer

On many systems you will find a mailx command which can be used to send email. This may be a link to the mail command, but changes the behavior of the command. As other have noted, this assumes you have a MTA (Mail Transfer Agent) configured on your server. It can be used interactively using a command like:

mailx -s "This is a message"
This is a message

Or with a pipe to send the output of a command:

cat myfile.txt | mailx -s "This is the file"

Running it as mailx -h should give you usage instructions.

share|improve this answer

If you're not bound to the mail command, nail offers a similar interface but can send mail using SMTP.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .