解决方法
formail,procmail的一部分(可能已在您的系统上可用)可以获取邮箱,将其拆分为消息,然后在每个邮箱上运行命令.从手册页:
- -s The input will be split up into separate mail messages,and piped
- into a program one by one (a new program is started for every
- part). -s has to be the last option specified,the first argument
- following it is expected to be the name of a program,any other
- arguments will be passed along to it. If you omit the program,then formail will simply concatenate the split mails on stdout
- again. See FILENO.
所以你可以做我想你想要的事情:
- formail -s /usr/sbin/sendmail -oi -t < /var/mail/root