简体   繁体   English

使用sendmail在Linux上将邮件消息另存为文件

[英]Save mail message as a file on Linux using sendmail

I have an application running on several RHEL 5.8 systems which monitors and alerts (via email). 我有一个在多个RHEL 5.8系统上运行的应用程序,该系统监视和警报(通过电子邮件)。 I need to create a durable log of these alerts locally on each node. 我需要在每个节点上本地创建这些警报的持久日志。

I think the easiest way to do this would be to add a local email user to the alerts and then use mailbox settings or a script (if needed) to save each message on a local filesystem 我认为最简单的方法是将本地电子邮件用户添加到警报中,然后使用邮箱设置或脚本 (如果需要)将每封邮件保存在本地文件系统中

I would settle for message body dumped to a text file (one file per email.) 我希望将邮件正文转储到文本文件(每封电子邮件一个文件)。

It would be better if it could extract time, host, subject, & body as seperate fields for consumption by an open source log reader. 最好将时间,主机,主题和正文作为单独的字段提取出来,以供开放源日志阅读器使用。

My systems are using sendmail 8.1 and I would prefer to stick with it, although I also have postfix 2.3.3 available. 我的系统正在使用sendmail 8.1,尽管我也有可用的postfix 2.3.3,但我还是希望坚持使用它。

As you reported your sendmail uses procmail as local mailer => create special OS user account (eg log_user) and use ~log_user/.procmailrc to instruct procmail to deliver messages to maildir folder. 如您所报告的,sendmail使用procmail作为本地邮件程序=>创建特殊的OS用户帐户(例如log_user),并使用~log_user/.procmailrc指示procmail将邮件传递到maildir文件夹。

~log_user/.procmailrc 〜LOG_USER / .procmailrc文件

# deliver ALL messages to ~/maillog/ maildir. 
# see "man procmailex" for email sorting examples 
:0
maillog/

暂无
暂无

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

相关问题 Linux sendmail命令在cron中不发送邮件 - Linux sendmail command not sending mail while in a cron 在Linux上,我想停止对特定Windows服务器的身份验证,该服务器将使用该服务器通过Sendmail发送邮件 - On Linux I want to stop authentication for a specific Windows server that will use it to send mail using Sendmail 需要使用其他Linux服务器的“ sendmail”发送邮件(bash或php脚本) - Need to send a mail (bash or php script) using “sendmail” of a different linux server 如何设置Debian Linux默认的外发邮件/发送邮件应用程序/脚本? - How to set Debian Linux default outgoing mail/sendmail application/script? apache在Linux上发送邮件时对sendmail.cf的适当权限 - Proper permission for sendmail.cf when apache sends mail on linux 如何在Linux中使用sendmail命令发送电子邮件 - How to send an email using sendmail command in linux 除了使用“<”运算符或“|”之外,有什么方法可以将文本文件传递给 sendmail 命令(在 linux 中) 操作员 - Is there any way we can pass a text file to sendmail command (in linux) other than using '<' operator or '|' operator 在linux邮件服务器上查找邮件 - find mail message on linux mail server 使用ssmtp随邮件一起发送HTML电子邮件(sendmail) - Using ssmtp to send HTML e-mails with mail (sendmail) 使用带有uuencode的“sendmail”发送邮件,并附带主题 - Send a mail using 'sendmail' with uuencode, and having a subject alongwith
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM