Q:

How do I send email from a terminal?

I have been trying to use the unix mail command to send emails, but haven't been having much success. I wasn't getting any errors though so I checked my var/mail file and found a lot of these messages:

Mailing to remote domains not supported

That makes sense, because I haven't given it an SMTP server, but how do I do this? I read through the man mail page and didn't see anything that would help, and googling took me to this page which left me feeling confused and rather unintelligent.
Is there a guide for setting up smtp settings which is not too much harder than it should be?

A:

Like others have said, you'll need to set up a local mail server (sendmail, postfix, or whatever is your preference). 
My assumption is that you're doing this from your home and you get an IP that changes every so often. If this is the case, then you'll find other problems with sending email. A lot of servers will simply deny you because of your IP address (see spamhaus or others).
To get around this, you'll need a relay (or ideally, a static IP* and DNS). Your ISP may provide you with an relay (you may need to ask) at which point you'll simply add the following directives 
If you're using sendmail:
 define(`SMART_HOST', `smtp.your.provider')dnl

If you're using postfix:
relayhost = smtp.your.provider

Where smtp.your.provider would be your relay host (this can be an IP as well).
Here are some guides for sendmail and postfix. 
I use both; however, I think postfix is supposed to be easier and safer, but good practices it what really makes the difference. On Redhat-like systems (Fedora, CentOS, RHEL, Oracle, and so on) Sendmail seems to be default while others use Postfix.
*static IP isn't necessary, but makes life so much easier.

