I know I can download emails using a client, but is there a way to download emails straight from the terminal? I'm trying to fetch some emails from my gmail to later do some analysis on certain emails.
EDIT: Thank you for all the answers. Right now, I found a way to do it with getmail. But I encountered a small issue. It downloads the emails and attachments, but it prints everything in text. Is there a way to actually retrieve said attachment?