Force Email Delivery on Exim

Hundred emails are queuing on your mail relay server, and you have to push the email to the destination mail server after it has came online. Using exim -M can helps you to delivery the email instantly.

First and foremost, find out how many email is in the queue for a specific domain

shell> exim -bp | grep [domain name]
44m  1.7M xxxxx-000HXZ-4V 

44m  803K xxxxx-000HZ0-0h 

44m   74K xxxxx-000Gzk-6M 

Alright, you have grepped the email which are queuing on your mail server, which delivered to your relay server on 44 minutes ago with the email id. To deliver the email to destination mail server

shell> exim -M xxxxx-000HXZ-4V
shell> exim -M xxxxx-000HZ0-0h
shell> exim -M xxxxx-000Gzk-6M

What is there are more than 50 emails? Here is a simple sample bash script showing how to deliver the email to destination email server.


MAILID=(`$EXIM -bp | $GREP [the-domain] | $AWK '{print $3}'`)

for item in ${MAILID[*]}
    echo "flush email ID $item"
    $EXIM -M $item

Sit back and relax, the email is being push to the destination mail server. Check your email logs to see delivery status.