May 17

วันนี้นั่งเล่น maildrop มา ก็เลยหยิบมาแบ่งปันกันให้คนอื่นได้ใช้นะครับ
อันนี้เป็นไฟล์ mailfilter ซึ่งอยู่ใน /var/vpopmail/domains/example.net/

SHELL="/bin/sh"
import EXT
import HOST
VPOP="| /var/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/var/vpopmail/bin/vuserinfo -d $EXT@$HOST`

#logfile “/var/log/maildrop.log”
log “=== BEGIN maildrop processing for $EXT@$HOST ===”

if ( $VHOME eq “” )
{
#log ” ERROR: VHOME isn’t set, falling back to vdelivermail”
#log “=== EXIT === ”
to “$VPOP”
}

# make special folder
`test -d $VHOME/Maildir/.Spam`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Spam directory”
`/usr/local/bin/maildirmake -f Spam $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Drafts`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Drafts directory”
`/usr/local/bin/maildirmake -f Drafts $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Sent`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Sent directory”
`/usr/local/bin/maildirmake -f Sent $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Trash`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Trash directory”
`/usr/local/bin/maildirmake -f Trash $VHOME/Maildir`
}

# try filtering it using user-defined rules
`test -r $VHOME/.mailfilter`
if( $RETURNCODE == 0 )
{
#log ” INFO: including $VHOME/.mailfilter”
exception {
include $VHOME/.mailfilter
}
}

if (/^X-Spam-Status: *Yes/)
{
# then try delivering it to a Spam folder
exception {
# to “$VPOP”
to “$VHOME/Maildir/.Spam/”
}
# ah well, I guess they’ll just have to live with disappointment
exception {
to “$VPOP”
}
}
else
{
exception {
#log ” INFO: message is clean”
to “$VPOP”
}
}

ต่อจากนั้นแก้ไข /var/vpopmail/domains/example.net/.qmail-default
#| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox
| /usr/local/bin/maildrop /home/vpopmail/domains/example.net/mailfilter

เป็นอันเสร็จพิธี ใครจะ debug ก็ uncomment logfile ด้วยนะ

อ้างอิง

written by Mr-San \\ tags: ,

May 04

Do you know Foxkeh?

Foxkeh was born to boost the promotion of Firefox in Japan and has become quite popular on the Internet.

This quote from Foxkeh.com, which website born to spread firefox from japan with cute mascot
Foxkeh

I like this template and all about Firefox.

written by Mr-San \\ tags: , ,

Close
E-mail It