Chinaunix首页 | 论坛 | 博客
  • 博客访问: 579841
  • 博文数量: 142
  • 博客积分: 10016
  • 博客等级: 上将
  • 技术积分: 1835
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-10 14:30
个人简介

工作中~

文章分类

全部博文(142)

文章存档

2009年(25)

2008年(117)

我的朋友

分类:

2008-07-22 12:25:37

OMS_Tutorial_Maildrop_zh  
[OMS Tutorial] Install and configure courier maildrop.

$Revision$,$Author$

  • ().
  • Author: Zhang Huangbin (michaelbibby gmail.com).


# pkg_add maildrop

maildrop
-2.0.2p2: complete                                                  
--- maildrop-2.0.2p2 -------------------
The documentation for maildrop has been installed in
/usr/local/share/doc/maildrop.

You should also read /usr/local/share/doc/maildrop/SECURITY
file now
, as it has
some important information regarding the setuid
/setgid
bits that some of the binaries that have been installed
may need
for correct operation.

There are currently NO setuid/gid bits enabled, but if you
use maildrop in certain capacities, these will need to be
set to allow maildrop to
function correctly.

#
# File: /etc/courier/maildroprc
#

#
# logfile should be owned by user/group: vmail, mode: 0640.
# A newsyslog configuration was created for logrotate.
#

logfile
"/var/log/maildrop.log"

SHELL
="/bin/sh"
HOME
="/home/vmail/domains"
MAILDIR
="Maildir/"

LOGNAME
=tolower("$LOGNAME")  # 'username@domain.com'
EXTENSION
="$1"                 # default is 'spam'
RECIPIENT
=tolower("$2")
USER
="$3"                 # 'username'
HOST
="$4"                 # 'domain.com'
SENDER
="$5"

USERHOME
="$HOME/$HOST/$USER"
MAILBOX
="$HOME/$HOST/$USER/$MAILDIR"

#
# Only allow users listed in file '/etc/postfix/www_at_openbsdonly.org' send
# mail to user 'www@openbsdonly.org'.
# File '/etc/postfix/www_at_openbsdonly': one email address per line.
#
#if ( /^To:.*www@openbsdonly.org.*/ )
#{
#    if ( /^From:\s*(.*)/ && lookup( $MATCH1, '/etc/postfix/www_at_openbsdonly.org'))
#    {
#        MAILBOX="${MAILBOX}"
#    }
#    else
#    {
#        to /dev/null
#    }
#}

if ( $EXTENSION = 'spam' )
{
    EXTENSION
= 'Spam'
}

#
# $HOME/.mailfilter
#   Owner:  2000:2000
#   Mode:   0600
#
`test -r $HOME/.mailfilter`
if ( $RETURNCODE == 0 )
{
    include $HOME
/.mailfilter
}

`test -e $MAILBOX`
if ( $RETURNCODE != 0 )
{
   
# Create user home directory.
   
`mkdir -p $USERHOME`

   
# Create Maildir.
   
`maildirmake $MAILBOX && maildirmake -f $EXTENSION $MAILBOX `

   
# Auto-subscribe the subdirectory to imap server.
   
`print INBOX.Sent > $MAILBOX/courierimapsubscribed`
   
`print INBOX.Trash >> $MAILBOX/courierimapsubscribed`
   
`print INBOX.Drafts >> $MAILBOX/courierimapsubscribed`
   
`print INBOX.Spam >> $MAILBOX/courierimapsubscribed`

   
# Set permission.
   
`chown 2000:2000 -R $MAILBOX `
   
`chmod 0700 $USERHOME`
}

if (/^X-Spam-Flag:.*YES/)
{
    log
"Spam detected. Move to the SPAM Folder: $MAILBOX/.$EXTENSION"
    MAILBOX
="$MAILBOX/.$EXTENSION/"
}

to $MAILBOX









阅读(1950) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~