inn 提供的 perl 脚本 —— news2mail,可以将新闻组文章以邮件方式转发。
new2mail 通过在配置文件 newsfeeds 中,添加相应的 channel feed 实现。还有一个重要的配置文件 news2mail.cf,用来和相应的 channel feed 的地址名匹配,提供相应的邮件地址。
例如:下面的示例,将新闻组:internal.list.linux.kernel ,发往邮件地址:linux-kernel@vger.kernel.org 。
配置文件:newsfeeds
ME:!*:: # ^^ the exclamation mark is absolutely important, because without it everything will be send out to all feeds, # also to the mailing lists (again: EVERYTHING) n2m!:!*:Tc,Ac,Wn*:/usr/lib/news/bin/news2mail #^^^ this entry only once # #the following entry only once per newsgroup, which should be send out via news2mail news-internal.list.linux.kernel@example.com:internal.list.linux.kernel/!mailpost:Tm,Ac:n2m! #^^sender email addresse for outgoing mails ^^the newsgroup ^ ^^ flags # | this is the filter key; every articel which has # | this key in his Distribution: header will not be mailed; # | all news articles that will enter via mailpost # | will have this key in the Distribution: header -> no loop!
配置文件:news2mail.cf
#one entry per newsgroup: news-internal.list.linux.kernel@example.com linux-kernel@vger.kernel.org #^^ sender address ^^ recipient addresse # it is important that the first field of both files is identical (sender)
new2mail 为防止DOS攻击,将邮件排入队列,而不是直接发送。因此邮件发送是否及时,由 sendmail 启动时的 -q 参数决定,或者将 "sendmail -q" 放入 crontab。 但是我在调试过程中,发现以参数 "-odq" 调用 sendmail,邮件队列中没有邮件,邮件发送失败!因此需要修改脚本 news2mail,修改调用 sendmail 的参数。
还有在调试 news2mail 过程中,发现 perl 脚本的 syslog 调用并不能出现预期结果。原因是 syslogd 启动时默认不接收外部的 syslog 事件,导致 perl 的 syslog 调用不能显示。修改文件 /etc/sysconfig/syslog
,加上 '-r' 参数启动 syslogd。
Copyright © 2006 WorldHello 开放文档之源 计划 |