Is there a command line mail program for Mac?

Solution 1:

This sure takes me back to my university days...

Mutt has still got to be one of the best terminal-based mail clients out there. It's been around longer than I'd like to admit. It's available as a homebrew package:

> brew info mutt
mutt 1.5.21
http://www.mutt.org/
Depends on: tokyo-cabinet
Not installed
http://github.com/mxcl/homebrew/commits/master/Library/Formula/mutt.rb

Overall you'll get a much better experience using something like Mutt than you will with something like mail because it supports IMAP, POP3 and SMTP -- you don't have to learn sendmail or anything like that to get it to work with your accounts.

You can even use Mutt with Gmail if that's your bag. See this article for details on setting up Mutt to work with Gmail.

Pretty colours...

Mutt in action

Solution 2:

Yes and here is another one called the Alpine Messaging System a.k.a Alpine. Available from the University of Washington

Alpine is a free software email client developed at the University of Washington. Alpine 1.0 was publicly released on December 20, 2007. The name "Alpine" stands for Alternatively Licensed Program for Internet News and Email. Alpine is a rewrite of the Pine Message System that adds support for Unicode and other features. Alpine is meant to be suitable for both inexperienced email users and the most demanding of power users. Alpine is developed at the University of Washington, as was Pine before it. Alpine can be learned by exploration and the use of context-sensitive help. The user interface can be customized.

If you install MacPorts you can install alpine by doing the following:

sudo port install alpine

Alpine 2.0 in action

Solution 3:

For a full fledged terminal based email client that supports most email protocols, I'd suggest using mutt. You can download mutt from here, if you'd like to build from source. This webpage gives you directions on how to install on OS X.

If you use homebrew, then installing is as simple as brew install mutt (and similarly for fink and macports).

Here are a few basic steps to get your .muttrc configured:

#Set account info
set spoolfile=/var/spool/mail/jdoe #if using IMAP, use imaps://example.com/INBOX
set folder="$HOME/mail"            #if using IMAP, use imaps://example.com/
set imap_user=jdoe
set from='[email protected]'
set realname='John Doe'
set signature="~/.signature"

#Mailbox behaviour
set mail_check=15                  #check for new mail
set timeout=30
set include=yes                    #quote when replying

#Compose/reply/etc...
set editor=vim                     #change to your favourite command line editor  
ignore headers *
unignore headers from to subject date cc
hdr_order from to cc subject date
set fast_reply                     #don't ask for to, subject when replying
unset metoo                        #remove myself from replies
set sort=date-received

You can customize these further as you wish, and there are also some useful questions in the mutt tag on Unix.SE and StackOverflow

Solution 4:

Take a look at the mail command. It will let you send and receive email in the Terminal.