Procmail高级应用与SpamAssassin反垃圾邮件策略
1. Procmail高级功能
Procmail是一款强大的邮件处理工具,能帮助我们更好地管理邮件。下面介绍其一些高级应用。
1.1 日期变量分配与目录创建
我们可以通过正则表达式从日期中提取年、月、日信息,并创建对应的目录结构。以下是具体代码:
#This obtains the date formatted as YYYY MM DD date = `date "+%Y %m %d"` #Now assign the Year YYYY style :0 * date ?? ^^()\/ { YYYY = $MATCH } #Now assign the Year YY style :0 * date ?? ^^..\/ { YY = $MATCH } #Now assign the Month MM style :0 * date ?? ^^.....\/ { MM = $MATCH } #Now assign the Day DD style :0 * date ?? ()\/..^^ { DD = $MATCH } #Create the various directory formats you are going to use DUMMY=`test -d ${YYYY}/${MM}/${DD} || mkdir –p ${YYYY}/${MM}/${DD}` DUMMY=`test -d ${YY}/${MM} || mkdir –p ${YY}/${MM}`这个流程可以用以下m