简体   繁体   English

Procmail/munpack:提取类似于文本和附件的标题?

[英]Procmail/munpack: Extracting headers similar to text and attachments?

I currently have set up fetchmail to transfer mail to procmail and a .procmailrc file with the following content:我目前已经设置 fetchmail 将邮件传输到 procmail 和一个 .procmailrc 文件,其内容如下:

FILE_DIR=$HOME/incoming
:0
* 
| munpack -q -C "$FILE_DIR"

If I receive emails with attachments, munpack will create a file123.ext and a file123.desc, the latter containing the text of the email.如果我收到带有附件的电子邮件,munpack 将创建一个 file123.ext 和一个 file123.desc,后者包含电子邮件的文本。 However, the headers are lost.但是,标题丢失了。 Is there a way to save the headers of the email to a file123.headers file or something like that or, better yet, make munpack save the whole message - including headers - in the .desc file?有没有办法将电子邮件的标题保存到 file123.headers 文件或类似的文件中,或者更好的是,让 munpack 将整个邮件(包括标题)保存在 .desc 文件中?

You can easily save the headers separately, but of course you can't predict which file name munpack will assign to the extracted message.您可以轻松地单独保存标题,但当然您无法预测munpack将分配给提取的消息的文件名。

:0hc
headers

:0
| munpack -q -C "$FILE_DIR"

This simply writes the headers to headers .这只是将标题写入headers Perhaps you could add some logic around this to create a new directory for each incoming message, or something like that.也许您可以为此添加一些逻辑来为每个传入的消息创建一个新目录,或者类似的东西。

(Notice also how you simply omit the condition line if you want to deliver unconditionally.) (另请注意,如果您想无条件交付,您如何简单地省略条件行。)

Maybe a better solution would be to switch to a tool which extracts the headers as well.也许更好的解决方案是切换到一个也提取标题的工具。 I vaguely recall ripmime would be somewhat more flexible than munpack .我依稀记得ripmime会比munpack更灵活一些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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