cPanel/WHM - Exim Useful Commands

Exim CheatSheet

  1. To check the number of emails present in the queue:
# exim -bpc
  1. To check the emails present in the queue with the mail id and sender ID:
# exim -bp
# exim -bp | less
  1. To view the header of a particular email using mail ID:
# exim -MvH mail_id
  1. To view the body of a particular email using mail ID:
# exim -Mvb mail_id
  1. To view a message’s logs:
# exim -Mvl mail_id
  1. To trace path:
# exim -d -bt user@domain.com
  1. To get sorted list of email sender in exim queue:
# exim -bpr | grep "<" | awk {'print $4'} |cut -d "<" -f 2 | cut -d ">" -f 1 | sort -n | uniq -c| sort -n
  1. To check the script that will originate spam mails:
# grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n
#
grep "cwd=" /var/log/exim_mainlog|awk '{for(i=1;i<=10;i++){print $i}}'|sort| uniq -c|grep cwd|sort -n
  1. If we need to find out exact spamming script. To do this, run following command:
# ps aux | grep user | grep --color=always "/home/user/public_html/templates/" | head
  1. To delete the emails of a specific user:
# grep -lr 'user@domain.com' /var/spool/exim/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
# exim -bp | grep "user_email-account" | awk '{print $3}' | xargs exim -Mrm
  1. To delete Frozen emails from the email queue:
#grep -R -l '*** Frozen' /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm
# exim -bp| grep frozen | awk '{print $3}'| xargs exim -Mrm
# exiqgrep -z -i | xargs exim -Mrm
  1. To delete Spam emails from the email queue:
# grep -R -l [SPAM] /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm
  1. To check the no. of frozen mails:
# exiqgrep -z -c
  1. To check exim logs:
# tail -f /var/log/exim_mainlog
  1. Force delivery of one message:
# exim -M mail_id
  1. Force another queue run:
# exim -qf
  1. Force another queue run and attempt to flush frozen messages:
# exim -qff
  1. To check if there are frozen emails:
# exim -bp |awk '/fr[o]zen/ {print}'
  1. To clear just one email:
# exim -Mrm mail_id
  1. Check the subjects of the emails:
# exiqgrep -i |awk '{ print "exim -Mvh "$1 }' |sh |grep -i Subject
  1. Delete the email which content some string in the message body
# grep -lr 'photos to album' /var/spool/exim/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
 
  • exim, exim commands, exim cheat sheet
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to access VPS by SSH for first time?

You need to download latest version of Putty.exe file here: https://putty.org/ Open...

What is the requirements to Buy Pakistan Hosted VPS?

We Provide Pakistan Hosted VPS Servers only to Pakistani Customers. VPS Servers are hosted in...

How to change SSH Port in CentOS?

Connect to your server via SSH as root user. Run the following command: vi...

How to change server root password using SSH or VPS Portal?

Connect to your server via SSH as root user. Enter the command:passwd Type your password,...

How to Install CSF firewall in cPanel?

CSF firewall is fairly easy to install and require only few steps through SSH. Please follow the...