Archive for the ‘Exim’ Category

You can set the mail filter from your cPanel.Please refer the following steps to set the filter.

1] Go to cPanel
2] Go to Mail >> email filtering
3] Click on Add filter option

This option is also very useful when your clients domain marked as Spam in your mail box.For example if email came from marked as Spam email then you can set the filter in following manner to avoid Spam mail problem for your domain

1] Go to cPanel
2] Go to Mail >> email filtering
3] Click on Add filter option
4] Then as per your email headers you can set the filter here
5] Destination should be allow
6] Click on activate option.

So that all the emails from not be treated as spam.

Exim is a mail transfer agent (MTA) used on Linux/Unix-like operating systems. It is freely available under the GNU GPL and it aims to be a general and flexible mailer with extensive facilities for checking incoming e-mail.

Normally default port for exim is 25. but most of the ISP block port 25. so it is necessary that an altername port for exim is open on server. Following are the steps to configure alternate port on cpanel/WHM installed on the server.

1) Login to WHM as root.

2) In WHM click on  Main >> Service Configuration >> Service Manager

3) Now tick the check box under Exim on another port and also enter the alternate port no: in the corresponding text box.

Here you go… Cheers

Execute following command to delete emails of particular email address from the queue.

exiqgrep -ir “” | xargs -n1 exim -Mrm

Execute following command to delete emails of particular domain address from the queue.

exiqgrep -ir “” | xargs -n1 exim -Mrm

Note: Replace with your orignal domain name.

Following is the command to delete frozen mails.

exiqgrep -z -i | xargs exim -Mrm

You can also use following command to delete frozen mails

exim -bp | awk ‘$6 == “frozen” {print $3}’ | xargs exim -Mrm

To check number of frozen mails

exim -bp | grep frozen | wc -l

The message-IDs that Exim uses to refer to messages in its queue are mixed-case alpha-numeric, and take the form of: xXX-YYYY-ZZ. Most commands related to managing the queue and logging use these message-ids.
There are three — count ’em, THREE — files for each message in the spool directory. If you’re working in these files by hand, instead of using he appropriate exim commands as detailed below, make sure you get them all, and don’t leave Exim with long list of messages in the queue.

Files in /var/spool/exim/msglog contain logging information for each message and are named the same as the message-id.

Files in /var/spool/exim/input are named after the message-id, plus a suffix denoting whether it is the envelope header (-H) or message data (-D).

These directories may contain further hashed subdirectories to deal with larger mail queues, so don’t expect everything to always appear directly on the top /var/spool/exim/input or /var/spool/exim/msglog directories; any searches or greps will need to be recursive. See if there is a proper way to do what you’re doing before working directly on the spool files.

Below are some useful commands for managing an Exim server::

1) Print a count of the messages in the queue:

root@localhost# exim -bpc

2) Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):

root@localhost# exim -bp

3) Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

root@localhost# exim -bp | exiqsumm

4) Generate and display Exim stats from a logfile:

root@localhost# eximstats /path/to/exim_mainlog

5) Generate and display Exim stats from a logfile, with less verbose output:

root@localhost# eximstats -ne -nr -nt /path/to/exim_mainlog

6) Generate and display Exim stats from a logfile, for one particular day:

root@localhost# fgrep 2007-02-16 /path/to/exim_mainlog | eximstats

7) Print what Exim is doing right now:

root@localhost# exiwhat

8 ) To delete frozen emails

exim -bp | awk ‘$6~”frozen” { print $3 }’ | xargs exim -Mrm

9) To deliver emails forcefully

exim -qff -v -C /etc/exim.conf &

10) To check the port and exim status


If you are getting following error while sending email from SquirrelMail then just restart Iptables or stop and start IPtables. That will fix the issue

Connection refused 111 Can’t open SMTP stream

Command to restart Iptables

/etc/init.d/iptables restart

Commands to stop and start IPtables

/etc/init.d/iptables stop
/etc/init.d/iptables start

If  it does not resolve the issue then restart exim service.