从我的博客http://blog.malowa.de/2011/04/postfix-as-spam-trap-server.html复制并稍作修改:
您甚至不必将Postfix配置为充当nullmailer。Postfix附带了一个名为的整洁工具smtp-sink
,可以完成此操作。smtp-sink主要用于充当需要使用服务器的SMTP客户端的测试工具。因此,您可以将其配置为记录整个对话,甚至将每个收到的邮件转储到文件中。空邮件程序需要后者。
没有配置文件来配置smtp-sink。一切都通过命令行选项完成。
smtp-sink -c -d "%Y%m%d%H/%M." -f . -u postfix -R /tmp/ -B "550 5.3.0 The recipient does not like your mail. Don't try again." -h spamtrap.example.com 25 1024
让我们仔细看看每个参数。
-u postfix
Runs the program under the user "postfix"
-R /tmp/
Sets the output directory to /tmp/. In this directory the mails will be stored. If you have a high spam volume (hundreds of Spam per minute) it is recommended to write the mails to a ramdisk
-d "%Y%m%d%H/%M."
Writes the mail to a directory of the format "YearMonthDayHour" and in this directory the files are name "Month.RandomID". Note that the dates are in UTC
-c
Write statistics about connection counts and message counts to stdout while running
-f .
Reject the mail after END-OF-DATA. But the mail will be saved. Cool, isn't it?!
-B "550 5.3.0 The recipient does not like your mail. Don't try again"
This is the rejection message after END-OF-DATA.
-h spamtrap.example.com
Announce the hostname spamtrap.example.com
25
The port to listen on. Can be prepended with an IP or host if you want to bind on a special interface.
1024
The backlog count of connections that can wait in the TCP/IP stack before they get a free slot for sending mail.
您可以在smtp-sink的手册页中找到更多信息,但这是运行全部垃圾邮件陷阱的重要信息。在这种配置下,程序可以从任何发件人到具有IPv4和IPv6的任何收件人的任何大小的邮件。唯一的限制是只能有256个同时连接和1024个排队连接,并且该程序被标记为试验性的。因此,请勿在生产环境中使用smtp-sink。
-B选项仅在较新版本的Postfix中有效。在2.7.1中已丢失。在2.8.2中存在。介于两者之间的某个地方。