• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Simple check amount of messages in qmail queue including bulk mail using qread

Lupker

New Pleskian
Hi folks,

After a SPAM attack I wanted to monitor my mail queue a little better.
Because every SPAM mail contained more than 200 recipients, the qmail-qstat was not efficient.
So I've written a simple script using the qmail-qread, which gives me an estimate of the amount of messages in the queue by reading the amount of lines.

There are some suggestions the mail will not be send because the mailqueue is full, but I guess I will notice when I put this in a cron job every 5 minutes..

Just wanted to share this script:

Code:
#!/bin/sh
# Send an email when there are more then 1000 messages in the mail queue
# This is counted by the amount of lines in the qmail-qread output, so it's an indication...

qread="/var/qmail/bin/qmail-qread"
len=`$qread | wc -l`

if [ $len -gt 1000 ]; then

	#!/bin/bash
	# script to send simple email 
	# email subject

	SUBJECT="WARNING: There are $len messages in the mail queue!"

	# Email To ?
	EMAIL="YOUR@EMAIL.COM"

	# Email text/message
	EMAILMESSAGE="/tmp/emailmessage.txt"
	echo "WARNING: There are $len messages in the mail queue!" > $EMAILMESSAGE
	/var/qmail/bin/qmail-qstat >> $EMAILMESSAGE
	/var/qmail/bin/qmail-qread >> $EMAILMESSAGE
	echo "> This is a chkmailq script..." >> $EMAILMESSAGE

	# send an email using /bin/mail
	/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
fi

Gr,
Mark
 
Back
Top