[英]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. 我有一个电子邮件地址email_reports@coldmail.com
,每天都会收到一些报告。 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? 如何通过终端访问该邮件,找到所需的特定邮件(例如,检查标题或正文中是否包含字符串DEBUG: Daily Data Report
),然后通过单个管道命令将其正文打印到文件中? I have Ubuntu 12.04 LTS, and the standard mail
command, as well as mutt
. 我有Ubuntu 12.04 LTS,标准的mail
命令以及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. 有关如何将传入邮件传递到脚本的出色文章,请参见http://harrybailey.com/2009/02/send-or-pipe-an-email-to-a-php-script/ 。 This technique can be used to pipe incoming mail to just about any kind of script, be it php, perl, python, etc. 可以使用此技术将传入的邮件传递到几乎任何类型的脚本,例如php,perl,python等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.