Is there any CLI email client/program which can read email mailbox file (with single email message) and produce output to stdout main headers and text?

$ mailcmd < email.file
From: some@email.com
Subject: some subject
Message text: Hello world!
  • I don't uinderstand, what's the content of email.file? – A.B. Mar 20 '16 at 17:52
  • email.file has the same format as /var/mail/user mailbox file. And email.file contains single email message. – Dimetry Mar 20 '16 at 18:15

Possible solution:

mutt -f email.file -e "push <decode-save><Return><Return><quit><Return>"

-e key execute following command
push add key sequences to the keyboard buffer

As result I get file with main headers and plain text from raw mailbox file

When I execute the script under cron or procmail:

export LANG=en_US.UTF-8 && screen -dm mutt -f email.file -e "push <decode-save><Return><Return><quit><Return>"

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.