I would like to use some tool from command line, to check and download mail, from different providers (gmail, hotmail, yahoo...) periodically and automatically, and save them as text files, preferably a text file for each email. I don't want my previous emails, so it shoud be possible to specify not to download previous emails, but only new ones since this solution is set up. I have been looking for such a thing and found fetchmail, but it saves all the messages in a single mbox file. What do you suggest? Thanks

EDIT: This is not a duplicate of the question suggested, since I am not going to send any email from this computer. It will not even have a keyboard or mouse connected. My question is about downloading all my emails individually as plain text file ("readable"), and stored in txt format.

  • I have a method for saving emails to text files with mutt command line tool, but I only know of one-by-one approach – Sergiy Kolodyazhnyy Oct 6 '15 at 22:31

You can either chop the mbox file into pieces using a script (example), or use fetchmail and save the messages directly to a maildir folder.

Depending on what you're going to do with the messages you may be better off using a homemade solution altogether.

  • OP asks for a solution to save each message in a separate file. It's possible with fetchmail, but you should give more details in your answer. – A.B. Oct 6 '15 at 20:01
  • Thanks both for your interest. @Jan I would appreciate if you could elaborate a bit more, specially on the second option (fetchmail+maildir). About the script option, how does it work exactly, I have to run it after new mails have arrived, when they get stored in the mbox? As new mails come, they will be in same mbox, but if I run the script again, won't it extract once and again all the previous messages (that were already extracted the first time I ran the script? Cause I don't want that, plus it would be useless extra work. Regards. – tom_len Oct 6 '15 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.