Using the mail command

command lineemail

How do I use the mail command to check email (and send email) from gmail. Does it support labels? I couldn't have figure out where to put the username and password.
I tried to search for instruction but couldn't find any

Best Answer

The mail command is an old and primitive mail client. It only supports reading mail locally on a unix server, typically stored in mbox format in /var/mail or a similar location.

To read Gmail mail, you need to either use their web interface, or use a client that works with Gmail's POP3 or IMAP access, or use the unmaintained Gmailfs (not recommended for inexperienced users). I recommend IMAP (make sure that you've enabled IMAP access in your account).

There are many email clients that support IMAP. On the command line, you could use Mutt, Sup, one of the Emacs mail clients, or many others. Just about any GUI mail client supports IMAP. IMAP only defined folders, not labels (the difference is that a mail is only in one folder but can have many labels); not all good IMAP clients are good at managing labels, and I don't know what clients support labels well.

Another approach would be to have Gmail forward all mails to your machine. But that requires an always-on, always-connected machine, and some technical know-how. I don't recommend this for an inexperienced user. And I'd recommend a more modern mail client than mail anyway.

Related Question