如何将邮箱分割成单个文件? [英] How to split mailbox into single file per message?

查看:277
本文介绍了如何将邮箱分割成单个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将收件箱分为单独的文件(每个邮件一个文件),通过bash命令,也可能是Java中的简单程序。如何做?



WBR,Thanx。

解决方案

只需使用 formail formail 是一个程序,可以处理邮箱,为邮箱中的每个邮件执行一些操作,单独的邮件等。



更多信息: http://www.manpagez.com/man/1/formail /



如果您只需拆分邮箱分隔文件,
我会建议这样的解决方案:

  $ cat $ MAIL | formail -ds sh -c'cat> msg $ FILENO'

从man:



< pre class =lang-none prettyprint-override> FILENO
分割时,formail将当前输出的消息号
分配给此变量。通过预设FILENO,您可以
更改正在使用的初始消息号和
零填充输出的宽度。如果FILENO未设置,它将默认为000.
如果FILENO不为空,不包含数字,FILENO gen-
eration将被禁用。


I'd like to split my inbox into separate files (one file per one message) by bash command, or may be simple program in Java. How can I do it?

WBR, Thanx.

解决方案

Just use formail. formail is a program that can process mailbox, run some actions for each message in the mailbox, separate messages and so on.

More info: http://www.manpagez.com/man/1/formail/

If you want just split a mailbox to separate files, I would suggest such solution:

$ cat $MAIL | formail -ds sh -c 'cat > msg.$FILENO'

From man:

   FILENO
        While splitting, formail  assigns  the  message  number  currently
        being  output  to  this  variable.   By presetting FILENO, you can
        change the initial message number being used and the width of  the
        zero-padded  output.   If  FILENO is unset it will default to 000.
        If FILENO is non-empty and does not contain a number, FILENO  gen-
        eration is disabled.

这篇关于如何将邮箱分割成单个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆