如何邮箱分为每封邮件的单个文件? [英] How to split mailbox into single file per message?

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

问题描述

我想用bash命令分割我的收件箱到不同的文件(每一个消息一个文件),或者可以是简单的Java程序。我该怎么办呢?

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,感谢名单。

推荐答案

只需使用 FORMAIL FORMAIL 是可以处理的邮箱,请运行一些动作在邮箱中每封邮件,单独的邮件等程序。

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.

更多信息: 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'

从人:

   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天全站免登陆