# Read Mail in Terminal?



## pwharff (Nov 25, 2003)

Does anyone know how to read mail from the Mail app in Terminal?


----------



## Giaguara (Nov 25, 2003)

not from mail.app, but you can read and do your emails in the terminal.

www.mutt.org > allows you to use your text editor of choise for email, such as emacs, vi, vim ...

(and, depending where your email server is, you can telnet your emails maybe as well.)


----------



## pwharff (Nov 25, 2003)

Giaguara said:
			
		

> not from mail.app, but you can read and do your emails in the terminal.
> 
> www.mutt.org > allows you to use your text editor of choise for email, such as emacs, vi, vim ...
> 
> (and, depending where your email server is, you can telnet your emails maybe as well.)



I primarily use the GUI Mail.app when home, but want to be able to check it from work through an ssh connection.  Can mutt allow me to do this?


----------



## bjurusik (Nov 25, 2003)

Just telnet into the POP server. Something like this

telnet
open mail.mac.com 25 (i think that's the right port, or else it's 110)

usr "username"
pass "password"

list (lists all the messages on the server)

retr 23 (to get message number 23)

Just do a search on the web for POP RFC, it'll give you all the commands and what they do.


----------



## jhawk28 (Nov 25, 2003)

25 is the port for an SMTP server, 110 is the port for a pop server


----------



## pwharff (Nov 25, 2003)

bjurusik said:
			
		

> Just telnet into the POP server. Something like this
> 
> telnet
> open mail.mac.com 25 (i think that's the right port, or else it's 110)
> ...



Thanks for the advice, but what about mail that I have already downloaded?  There was an important message that I needed, so I ssh'd into my Mac and vi'd the "INBOX.mbox" file and performed a find, but this is just too awful of a way to read my email.  There must be an easier way or some kind of script that will allow me to read my email through the terminal.  Shell Script? AppleScript? Something.  I use a program called contacts to all me to read my AddressBook from the terminal, why can't something like this exist for Mail?


----------



## MisterMe (Nov 25, 2003)

pwharff said:
			
		

> Does anyone know how to read mail from the Mail app in Terminal?


Pine


----------



## scruffy (Nov 26, 2003)

pine uses the mbox format, which is the same format that Mail.app uses.  So, install pine, and then replace its mailbox files with softlinks to the ones Mail.app uses.

e.g. ln -s .pine/inbox.mbox ~/Library/Mail/POP-me@someserver/INBOX.mbox/mbox

Note that it's been a while since I had this set up, so I don't recall where pine puts its mailboxes.  The way I did it was to set everything up, and then see what files got created.

If I recall correctly, after pine had read and written the mbox file, Mail.app forgot which messages were read, so it thought I had 1,202 unread messages or whatever.

Now, this was under 10.0 and 10.1; in 10.2 Mail.app has changed the layout of its mail folders somewhat, with a few extra index files and the like, so maybe it won't have that effect anymore


----------



## fryke (Nov 26, 2003)

Ah. Good old pine. Yes.  However, you might want to think about IMAP for your needs. Yes, it's completely the other way 'round, but you'd like that. The server having the mail, I mean.


----------



## hazmat (Nov 26, 2003)

FWIW, mutt can read local mail or via IMAP or POP.  It can read multiple mailbox formats, including mbox and maildir.  A lot of people like Pine, which can probably do the same thing, but I prefer mutt, probably because I used to use elm.  Unless you keep your mailboxes under one directory, which mutt can look in, you can also read a mailbox like 'mutt -f /path/to/file'.  It's really easy to install from source, or I believe there is also a package for fink.

Hope this helps.


----------



## pwharff (Nov 26, 2003)

scruffy said:
			
		

> pine uses the mbox format, which is the same format that Mail.app uses.  So, install pine, and then replace its mailbox files with softlinks to the ones Mail.app uses.
> 
> e.g. ln -s .pine/inbox.mbox ~/Library/Mail/POP-me@someserver/INBOX.mbox/mbox
> 
> ...



Thank you so much, this was exactly what I was looking for!!!


----------

