免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 708 | 回复: 0
打印 上一主题 下一主题

Configuring Exim4 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-13 22:02 |只看该作者 |倒序浏览

2.6. Configuring Exim4 dot forward Filtering
For a detail discussion of Exim's filter system, you should check out Exim's documentation itself. For just the short of it, read on.
In order for Exim to recognize a .forward as having Exim4 filter rules, the first non-whitespace entry must be:
# Exim filter
Character case and anything following it on the same line are ignored.
Next, you'll likely want some rules in your Exim4 filter .forward file. Using a simple if then elif else endif construct you can perform various tests against each incoming email before delivery (or discarding) it to a specified location. You can perform evaluations against any existing entry in an email's header, like so:
# Match any email who's To: header contains "exim"
# and save it to .dir1
if $h_to: contains "exim" then save Maildir/.dir1/
# Match email with a From: header that's
# exactly "not@wanted.com" and save it to .SPAM
elif $h_from: is "not@wanted.com" then save Maildir/.SPAM/
endif
To access the email header of your choice, append $header_, or as abbreviated above, just $h_, to the full name of an email header, following by a colon (:). The keywords is and contains are self explanatory. The save keyword, when followed by a path that ends with a forward slash (/), will deliver the email being evaluated in Maildir format. As such, the trailing slash is crucial. Don't omit it.
In Courier's IMAP hierarchy, directories beneath the root are dot directories. In addition, all subdirectories are denoted by periods, not additional forward slashes. So, lists/Debian/User/ is actually .Lists.Debian.User/ on the filesystem and should be referred to in Exim filters as "save Maildir/.Lists.Debian.User/" for things to be saved the way you expect.
My own personal working Exim filter file looks like this:
# Exim filter
# Save yourselves
if error_message then finish endif
# Let's make use of pipes
# The script accepts input on STDIN and does stuff with the mail
if $h_Subject: contains "uptime report"
then
pipe "$home/bin/uptime.pl"
endif
# Handle mailing lists
if $h_List-Id: contains "leaplist"
then save Maildir/.mailinglists.leap.linux/
elif $h_from: contains "ebay.com"
then save Maildir/.Ebay/
elif $h_Sender: contains "LINUX-L"
then save Maildir/.mailinglists.LUG/
endif


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/10912/showart_199823.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP