Tuesday, June 29, 2010

Exim Commands and Configuration Files


Configuration Files of Exim :

  • /etc/exim.conf – exim main configuration file
  • /etc/localdomains – list of domains allowed to relay mail
  • Log : /var/log/exim_mainlog – incoming/outgoing mails are logged here
  • /var/log/exim_rejectlog – exim rejected mails are reported here
  • /exim errors are logged here
  • Mail queue: /var/spool/exim/input
  • Cpanel script to restart exim – /scripts/restartsrv_exim
  • Email forwarders and catchall address file – /etc/valiases/domainname.com
  • Email filters file – /etc/vfilters/domainname.com
  • POP user authentication file – /home/username/etc/domainname/passwd
  • catchall inbox – /home/username/mail/inbox
  • POP user inbox – /home/username/mail/domainname/popusername/inbox
  • POP user spambox – /home/username/mail/domainname/popusername/spam
  • Program : /usr/sbin/exim (suid – -rwsr-xr-x 1 root root )
  • Init Script: /etc/rc.d/init.d/exim
Trouble shooting and checking exim mail logs

1) Count the no of messages in the queue

#root@leo [~]# exim -bpc
3506
Here 3506 mails are in the queue.

2) Command To List All The Messages In The Queue.(Time, Size,Message ID,Sender,Receipient):-

#root@localhost# exim -bp
Other Options:- root@localhost#exim -bpru
If you want to list for the message for a particular domain issue the
following command:-
root@localhost# exim -bpru | grep openhelp.info

3) Command To Find The Details Of Messages In The Queue( Count, Volume,Oldest,Newest And Total):-

#root@localhost# exim -bp | exiqsumm
===========================
The result of the comand will be like this:-
1 3686 18h 18h ziro.net
1 1638 4d 4d znormativa.com
1 2662 11m 11m zoominternet.net
1 3174 24m 24m zpub.com
1 2048 2h 2h zufall.de
===========================
3583 18MB 9d 0m TOTAL

4) Command To Create And Display Exim Stats From The Log File:-

#root@localhost# eximstats /var/log/exim_mainlog
===========================================
The result of the command will be like this:-
sree @ openhelp.info = lookuphostT=remote_smtp:SMTP error from remote mail
server after end of data:mail.tripseinc.com [65.106.35.202]: 550 5.7.1
rquested action not taken: message refusedhost smtp.where.xeonerver.net
[18.19.80.14]:553 sorry, mail to that recipient is not accepted
Errors encountered: 9617
===========================================

5) Generate And Display Exim Stats For A Particular Date:-

#root@localhost# fgrep YYYY-MM-DD /var/log/exim_mainlog | eximstats
==============================================
The result of the command will be like this:-
Top 50 host destinations by message count
-----------------------------------------
Messages Bytes Average Host destination
Top 50 host destinations by volume
-----------------------------------------
Messages Bytes Average Host destination
Top 50 rejected ips by message count
-----------------------------------------
Messages Rejected ip
2 [65.98.14.123]
1 [65.98.35.126]
Top 50 temporarily rejected ips by message count
------------------------------------------------
Messages Temporarily rejected ip
8 [69.65.55.100]
============================================

6) To Print What Exim Is Doing Right Now:-

#root@localhost# exiwhat
======================================================
Result of this command will be like this:-
925 handling incoming connection from ([61.152.161.184]) [61.152.161.184]
1951 handling incoming connection from pc-206-216-44-190.cm.vtr.net [
190.44.216.206]
10714 daemon: no queue runs, listening for SMTP on port 26 (IPv4)
10720 daemon: -q1h, listening for SMTP on port 25 (IPv4)
10725 daemon: no queue runs, listening for SMTPS on port 465 (IPv4)
=====================================================

7)For Clearing All The Mails In The Queue:-

root@localhost#exim -bpru|awk {'print $3'}|xargs exim -Mrm

8)Search The Queue For Messages From A Specific Sender:-

root@localhost# exiqgrep -f [luser]@domain

9)Search The Queue For Messages From A Specific Receipient/Domain:-

root@localhost# exiqgrep -r [luser]@domain
Eg:-root@localhost# exiqgrep -r openhelp.info

10)Command To Print The Message ID’s In The Entire Queue:-

#root@localhost# exiqgrep -i
===========================
The Result of the command will be like this:-
1KZyz0-0004wH-6d
1KZzBW-0001sT-1j
===========================

11)Comand To Start A Queue Run:-

root@localhost# exim -q -v

12)Comand To Start A Queue Run For Just Local Deleveries:-

root@localhost# exim -ql -v

13)Counting The No Of Frozen Mails:-

#root@localhost#exim -bpru | grep frozen | wc -l

14)Deleting All The Frozen Mails In The Queue:-

#root@localhost#exiqgrep -z -i | xargs exim -Mrm

15)Deliver a specific Message:-

#root@localhost# exim -M

You need to give message Id After this.
Like :- root@localhost# exim -M 1KZyrO-0006Vy-R2

16)Remove A Message From The Queue:-

#root@localhost# exim -Mrm

17)Command To Freeze All Queued Mail From A Given Sender:-

root@localhost#exiqgrep -i -f l user @ domain.com | xargs exim -Mf

18)Command To View Message Header:-

#root@localhost# exim -Mvh
Eg:-root@localhost#exim -Mvh 1KZzeO-0005up-GW

19)Command To View MessageBody:-

#root@localhost# exim -Mvb
This Command will show the body of the message.
Eg:-root@localhost#exim -Mvb 2345fg-34

20)Command To View A Message’s Logs:-

#root@server1 [~]# exim -Mvl 1KZznJ-0003Wp-Vj

21)Deleting The Bounce Back Message s In The Queue:-

#root@leo [~]exiqgrep -if "<>" | xargs exim -Mrm
OR
#root@leo [~] exim -bp | grep '<>' | awk '{print $3}'| xargs exim -Mrm

Bounce Back Messages Will Be ending with "<>".

Eg:- 17m 3.1K 1KDDkk-0002YT-5G <>barry @ email.net

22)Deleting The Bounce Back Message’s for a particular Domain:-

root@xeon [~] exiqgrep -if openhelp.info | xargs exim -Mrm
root@xeon [~] exiqgrep -ir openhelp.info | xargs exim -Mrm

Tags:-exim,exim commands,exim issues,exim docs,exim troubleshooting,exim configuration files,exim server,exim logs,linux,linux exim,linux updates