Script for deleting all the mails in Qmail
1. create a file with the following statements, say delqmail
service qmail stop
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;
service qmail start
You may also include the directories like /var/qmail/queue/mess/bounce… etc.
2. Give executable permission to this file
3. Execute the script
How to change SMTP port in postfix
The default SMTP port is 25. In Postfix we can change it to some other port (say 6000) using the following steps.
Open the file master.cf.
$ vi /etc/postfix/master.cf
Add the following line to the file.
6000 inet n - n - - smtpd
Restart postfix.
$ /etc/init.d/postfix restart
You can check the connection to the new port using telnet. Also make sure that the new port is not blocked in the server firewall.
Useful Exim Commands
Exim is a mail transfer agent used on Unix-like operating systems. Exim is highly configurable, and therefore has features that are lacking in other MTAs. Exim has always had substantial facilities for mail policy controls, providing facilities for the administrator to control who may send or relay mail through the system.
To print a count of the mails in the queue -> exim -bpc
Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient) -> exim -bp
To show the current configuration file of exim -> exim -bP
To show the version and configuration file of exim -> exim -bV
Generate and display Exim stats from a logfile -> eximstats /var/log/exim_mainlog
Print what Exim is doing right now -> exiwhat
To Print the message-id of the messages in queue -> exiqgrep -i
To remove a mail from the queue -> exim -Mrm
To freeze a mail -> exim -Mf
To deliver a specific mail from the queue -> exim -M
To remove all frozen mails -> exiqgrep -z -i | xargs exim -Mrm
To view the headers of a mail -> exim -Mvh
To view body of a mail -> exim -Mvb
Spamd failing
If you find the “spamd” failing error on an exim restart.
Solution
When disabling “spamd”, the Cpanel create a file named “/etc/spamdisable” which may not get deleted on enabling the “spamd” feature again. Check the presence of the above said file.
The issue may also arise due to unavailability of the perl module “Mail::SpamAssassin” by installing the the same and on restarting the exim, the issue will be fixed.
1. /scripts/perlinstaller — - force Mail::SpamAssassin
Run exim restart
2. /etc/init.d/exim restart
Exim exiqgrep utility
Some Examples
For getting the message id of mails in the queue in which the receiving domain is yahoo.com
in which display option is i and selection criteria is r
For getting the message id of frozen messages
Try and test with other options you can handle the exim mail queue easily with this utility