In this article I'll review how to manage your Exim mail queue on your VPS (Virtual Private Server) or dedicated server via SSH. This will allow you to find out why sent messages haven't possibly been successfully delivered yet.

The MTA (Mail Transfer Agent) that runs on your server is called Exim and it controls your email deliveries. There are certain commands your can run over SSH that will allow you to manage the Exim mail queue and we'll be reviewing those below.

To follow this guide you'll have to have root access to either your VPS or dedicated server so you can access the Exim commands.

Viewing messages in the Exim mail queue

Using the steps below, I'll show you how to locate a message that we've attempted to send to user@example.com, but it hasn't arrived yet in that user's Inbox so we'd like to investigate why.

  1. Login to your server via SSH as the root user.
  2. Run the following command to view the current Exim mail queue:

    exim -bp

    You should get back something that looks like:

    8m 13K 1TwJgO-0001q8-E5 <sender@example.com> *** frozen ***
    user@example.com

    7m 7.5K 1TwJhK-00037o-U8 <sender@example.com> *** frozen ***
    user@example.com

    5m 8.0K 1TwJic-00047T-70 <sender@example.com> *** frozen ***
    user@example.com

    3m 7.6K 1TwJlQ-0006MV-84 <sender@example.com> *** frozen ***
    user@example.com

    In this case we can see that there are 4 messages waiting to try to deliver to user@example.com, but they are all frozen. This means Exim has encountered an error while trying to deliver the message, and it has frozen it, until the next delivery retry time.

  3. Now you can take one of the Exim message IDs from the queue and further investigate it in the Exim mail log as to why the message can't deliver with this command:

    exigrep -I -l 1TwJlQ-0006MV-84 /var/log/exim_mainlog

    This will give you back the full transaction of that message ID exposing

    2013-01-18 16:46:16 1TwJlQ-0006MV-84 <= sender@example.com H=localhost [127.0.0.1] T="Update on employee contacts" for user@example.com
    2013-01-18 16:46:16 1TwJlQ-0006MV-84 ** user@example.com R=virtual_user_maildir_overquota: Mailbox quota exceeded
    2013-01-18 16:46:16 1TwJlQ-0006MV-84 Completed

  4. Now in this case we can see that this message is failing because the user@example.com server is giving back an error of Mailbox quota exceeded.

    If you'd like to attempt to go ahead and forcefully try to re-send the message you can run this command on the message ID:

    exim -M 1TwJlQ-0006MV-84

    If you wanted to remove the message from the mail queue.

    exim -Mrm 1TwJlQ-0006MV-84

You should now know how to investigate messages in your Exim mail queue using Exim commands over SSH.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2014-07-21 3:38 am

This was very helpful for me to clear the frozen mail Queue.

Thank you!!

n/a Points
2014-07-21 3:45 am
You can improve this by providing a meaning of commands like -I, -Mrm, etc.
Staff
9,525 Points
2014-07-21 10:25 am
Hello Sameer,

Thank you for your suggestions. We have been updating our article on Linux Commands, and we will look into adding these.

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

3 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!