#!/bin/bash #Created by Henry Saptono # Script ini digunkan untuk men-generate file .procmailrc # Skenarionya : Seluruh account email vpopmail terdaftar dalam file # vpasswd yang biasanya terletak di /home/vpopmail/domains/yourdomain/ # Script ini akan mengambil data atau informasi mengenai username email account # dan Mail direktori nya. Kemudian script ini akan membuatkan file .procmailrc # yang nantinya digunakan untuk menentukan procmail dalam mendeliver email ke # masing-masing maildir user BASE="/home/vpopmail/domains" VPASS="$BASE/$1/vpasswd" if [ -z "$1" ] || [ -z "$2" ]; then echo " Gagal: diperlukan 2 buah argumen" echo "--Argument yang pertama berupa nama domain email" echo "--Dan Argument kedua berupa username(account email) Admin" echo " Gunakan: $0 " echo exit 1; fi if [ -d $BASE/$1 ]; then if [ `grep "^$2:" $VPASS|wc -l` -ne 1 ]; then echo "Gagal: username(account email) Admin $2 tidak ada :(" exit 1; fi; echo "# ---- Generated by $0 vpasswd to procmailrc generator at `date`" echo "# ---- $0 hacked by Henry Saptono, henry@lpknf.or.id " echo "VERBOSE=off" echo "MYDOMAIN=$1" echo "MAILDIR=$BASE/$1/$2/Maildir" echo "DEFAULT=\$MAILDIR/" echo "LOGFILE=$BASE/$1/$2/procmail.log" DOMREG=`echo "$1"|sed -e "s/\./\\\\\./g"` i=1 for x in `cut -f1,6 -d":" $VPASS`; do user=`echo $x|cut -f1 -d":"` maildir=`echo $x|cut -f2 -d":"` if [ $user == "postmaster" ] || [ $user == "$2" ]; then continue fi; echo echo "# No.$i mail directory for $user" echo ":0:" echo "* ^Delivered-To: $user@$DOMREG" echo "$maildir/Maildir/" i=$[i+1] done echo echo "# Total Account Email here: $i" exit 0 else echo "Gagal: Nama domain Tidak terdaftar/Tidak Ada ! :(" exit 1; fi;