Archive

Archive for the ‘Qmail’ Category

Count domain in mail.log (Qmail)

February 20th, 2009

 Powered by Max Banner Ads 
# cat /usr/local/sbin/count_mail_per_domain.sh
#!/bin/bash
logfile=$2
domain=$3
 
case "$1" in
        -t)
	cat $logfile |grep "to remote" | awk '{print $14}'
					| awk -F@ '{ field = $2 }; {print "domain: " field }'
					| sort |uniq -c |sort -nr
					| awk -v totale=0 '{totale=totale+$1; print ;} END {print "Totale giorno domini: "totale;}'
            ;;
 
        -su)
	cat $logfile |grep "to remote"  |grep -i "$domain"
					|awk ' { field = $14 }; {print "to remote: " field }'
					| sort| uniq -c| sort -nr
					| awk -v totale=0 '{totale=totale+$1; print ;} END {print "Totale giorno domini per utente: "totale;}'
            ;;
	-s)
        cat $logfile |grep "to remote"  |grep -i "$domain" |awk '{print $14}'
                                        | awk -F@ '{ field = $2 }; {print "to remote domain: " field }'
                                        | sort| uniq -c| sort -nr
                                        | awk -v totale=0 '{totale=totale+$1; print ;} END {print "Totale giorno domini: "totale;}'
 
         ;;
        *)
            echo $"Usage: $0 { -t /var/log/mail.log.0 }  for print total mail for domain "
            echo $"Usage: $0 { -su /var/log/mail.log.0 domain.com } for print total mail for single domain per user"
            echo $"Usage: $0 { -s /var/log/mail.log.0 domain.com } for print total mail for single domain"
            exit 1
 
esac

for more tips visit qmail relay to smarthost

Fabio Laganà Debian, Mailserver, Qmail, Shell, Uncategorized, awk, bash , , , , ,

Testing Simscan

July 29th, 2008

Before you add simscan to your qmail-smtpd run script and/or smtp.cdb file,
you might want to test it first. To test simscan, create a file similar to
the one below called “mail.txt”. Be sure to substitute appropriate email
addresses.

From: sender@domain.xyz

To: recipent@domain.xyz

Subject: Testing Simscan

Testing simscan

Next send the message using qmail-inject with the following command.

# QMAILQUEUE=/var/qmail/bin/simscan SIMSCAN_DEBUG=2 NOP0FCHECK=1
/var/qmail/bin/qmail-inject < mail.txt

This command sends the message to qmail with the appropriate environmental
variables set. The debug output will notify you of any errors.

Other tips on http://qmailwiki.org/index.php/SimScanTips

Fabio Laganà Debian, Linux, Mailserver, Qmail , , , ,