Exim

From My Wiki
Jump to: navigation, search

Set exim smtp delay

echo "sed -i '0,/delay = 20s/s//delay = 5s/' /etc/exim.conf" > /etc/exim/delay_unknown_hosts
/etc/init.d/exim  restart


Find spamming account

ps -C exim -fH eww | grep home

Queue summary

exim -bp | exiqsumm | head -n 3; exim -bp | exiqsumm | sort -nr | head -n 10


List queued messages grouped by address of sender

exim -bpr | grep -Eo "<[^ ]*@[^ ]*>" | sort | uniq -c  | sort -nr | head


Check what Exim is doing right now

root@localhost# exiwhat

Remove any mail from/to google.com

exiqgrep -i -r @booksefer.com | xargs exim -Mrm
exiqgrep -i -f @booksefer.com | xargs exim -Mrm


Exim commands

exim -M id      #Try to send the message with id id 

exim -qf (-v)   #Tell exim to process the entire queue again
exim –qff (-v)  #same as qf, but it will flush the frozen messages

exim -Mvl id    #view the message log for message id
exim -Mvh id    #view message id's headers
exim -Mvc id    #view message id's body + headers
exim -Mvb id    #view message id's body 
exim -Mrm id    #remove message id from the queue
exim -Mg id     #fail and send a bounce to the sender
exim -bp | exiqsumm    #Print summary of the messages in the queue
exiwhat        #show what exim is doing right now
exim -bpc      #show number of messages in the queue
exim 


Start a queue run

root@localhost# exim -q -v


Remove all frozen messages

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


Remove mails in queue from a particular sender

exiqgrep -i -f user@domain.com | xargs exim -Mrm


Remove mails to a particular sender in the queue

exiqgrep -i -t user@domain.com | xargs exim -Mrm

Test how exim will route a given address

root@localhost# exim -bt user@localdomain.com

Display Exim's configuration settings

root@localhost# exim -bP

Search the queue for messages from a specific sender

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

Search the queue for messages for a specific recipient/domain

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

Print messages older than the specified number of seconds. Eg: messages older than 1 hour

root@localhost# exiqgrep -o 3600 [...]

Print messages younger than the specified number of seconds. Eg: messages less than an hour old

root@localhost# exiqgrep -y 3600 [...]

Match the size of a message with a regex. Eg: Messages between 500-599 bytes

root@localhost# exiqgrep -s '^5..$' [...]

Match only frozen messages

root@localhost# exiqgrep -z

Match only Non-frozen messages

root@localhost# exiqgrep -x

Print just the message-id of the entire queue

root@localhost# exiqgrep -i

Start a queue run

root@localhost# exim -q -v

Start a queue run for just local deliveries

root@localhost# exim -ql -v

Remove a message from the queue

root@localhost# exim -Mrm [ ... ]

Freeze a message

root@localhost# exim -Mf [ ... ]

Thaw a message

root@localhost# exim -Mt [ ... ]

Deliver a message, but only if the retry time has been reached

root@localhost# exim -Mc [ ... ]

Force a message to fail and bounce as "cancelled by administrator"

root@localhost# exim -Mg [ ... ]

Remove all frozen messages

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

Remove all messages older than five days (86400 * 2 = 172800 seconds)

root@localhost# exiqgrep -o 172800 -i | xargs exim -Mrm

Freeze all queued mail from a given sender

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

Add a recipient to a message

root@localhost# exim -Mar 
[ 
... ] 

Edit the sender of a message

root@localhost# exim -Mes 

Force cleaning all queue:

exim -bp | grep \< | awk '{print $3}' | xargs exim -Mrm