简体   繁体   中英

How to access some email, and print a specific mail's message body?

I have an email address email_reports@coldmail.com , on which some reports are received daily. How can I access that mail through a terminal, find a specific mail that I need (say, check the headers or the body for string DEBUG: Daily Data Report ), and print out it's body to a file in a single piped command? I have Ubuntu 12.04 LTS, and the standard mail command, as well as mutt . I've tried searching for such functionality online, but all I've managed to find is guides on how to set up various mail agents, but not to process emails in a script-like fashion.

See http://harrybailey.com/2009/02/send-or-pipe-an-email-to-a-php-script/ for an excellent article on how to pipe incoming mail to a script. This technique can be used to pipe incoming mail to just about any kind of script, be it php, perl, python, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM