Is there a way to get information from email using the Terminal and without external software?

While I do not understand the Terminal or how email works well enough to know if this question is well-formulated, I am curious if there is a way to use the Terminal to access information from one's email account without using special software (such as Mutt: http://www.mutt.org). Can I tell the computer simply to go to that part of the internet and bring me back the information I want? If not, why not?


Solution 1:

It depends :-)

The Terminal.app itself doesn't know anything about Mail or the Internet, all (well, practically all, it can do some additional stuff but let's keep things simple) it can do is handle keyboard input and text output between the user and a so-called command shell (which on macOS usually is an application/binary called bash or nowadays zsh). So strictly speaking the answer is "no, Terminal.app is not able to access your mail".

If we widen the scope a bit and read the question as "Can I access my mail with bash/zsh and any Unix-type utility which is part of macOS and doesn't require additional installations" the answer is Yes. Using GNU Netcat to access your POP3 mail account shows how netcat (which is called nc on macOS) can be used to access mail stored on a POP server. I didn't find anything for accessing mail on an IMAP server but this should be possible as well.