In this article I'm going to walk you through using the Exim mail logs on your VPS (Virtual Private Server) or dedicated server to track down the delivery times for a specified email address.

A good example of when you might want to do this, is lets say that you are expecting an email from user@example.com, you wait and wait, and the message still hasn't shown up in your Inbox yet, even though they swore they've sent it already. Using the Exim mail logs on your server you can double check to ensure that a message from that user actually even attempted to be delivered to your server.

Please note that for you to follow along with the steps below, you would have to already have root access on either your VPS or dedicated server, so that you have access to the Exim mail logs.

Find all delivery times for an incoming message

Following from our example above, we're going to check for incoming messages as far back as our Exim mail logs go for the user@example.com address. Use the steps below to accomplish this.

  1. Login to your server via SSH as the root user.
  2. Run the following command to get all of the incoming mail activity for user@example.com and store it in a file called EMAIL_LOG:

    zgrep "<= user@example.com" /var/log/exim_mainlog* > EMAIL_LOG

    This could take some time to complete depending on how large your mail logs are.

  3. Now to check the time stamps when those incoming messages happened, you can use this pretty long one-liner of code:

    cat EMAIL_LOG | awk '{ gsub(":"," "); print $2,$3,$4}' | awk '{ gsub("-"," "); print $0}' | sort -nk2 -nk3 -nk4 -nk5 | awk '{print $2"/"$3"/"$1" "$4":"$5}'

    Code breakdown:

    cat EMAIL_LOG Read from the EMAIL_LOG file that we created.
    awk '{ gsub(":"," "); print $2,$3,$4}' Use the awk command along with its gsub function to globally substitute all of the colons : with blank spaces. Then print out the $2nd column which is the date, the $3rd column which is the hour, and the $4th column which is the minute from the mail log.
    awk '{ gsub("-"," "); print $0}' Use the awk command again with its gsub function to globally substitue all of the hyphens - with blank spaces, and then print out everything with the $0 variable.
    sort -nk2 -nk3 -nk4 -nk5 Sort numerically first by the 2nd column which is the month, followed by the 3rd column which is the day, then the 4th column which is the hour, and finally the 5th column which is the minute from the logs.
    awk '{print $2"/"$3"/"$1" "$4":"$5}' Use the awk command to format the timestamps to make them easier to read.

    This will give you back something like this:

    01/03/2013 12:06
    01/03/2013 12:07
    01/03/2013 12:18
    01/16/2013 17:41
    01/17/2013 15:35
    01/17/2013 15:54

    You can now go ahead and delete the EMAIL_LOG file that we created with the following command:

    rm -rf EMAIL_LOG

    Now you know what times the user@example.com address attempted to deliver a message to your server. If they said they sent you a message and the date and time they said they sent it at isn't showing up in this list. More than likely they had a delivery failure, such as they typed in your email address wrong, so it didn't attempt to go to your server.

Find all delivery times for an outgoing message

Now we can do the same thing to also track down the delivery times for outgoing messages from a certain user.

  1. Run the following command to get all of the outgoing mail activity for user@example.com and store it in a file called EMAIL_LOG:

    zgrep "=> user@example.com" /var/log/exim_mainlog* > EMAIL_LOG

    This could take some time to complete depending on how large your mail logs are.

  2. Now to check the time stamps when those outgoing messages happened, you can use the same long one-liner of code from above:

    cat EMAIL_LOG | awk '{ gsub(":"," "); print $2,$3,$4}' | awk '{ gsub("-"," "); print $0}' | sort -nk2 -nk3 -nk4 -nk5 | awk '{print $2"/"$3"/"$1" "$4":"$5}'

    This will give you back something like this:

    01/12/2013 23:24
    01/13/2013 10:42
    01/13/2013 11:06
    01/14/2013 12:39
    01/16/2013 17:41
    01/17/2013 12:48

    You can go ahead and delete the EMAIL_LOG file that we created with the following command:

    rm -rf EMAIL_LOG

    Now you know what times the user@example.com address delivered a message from your server.

You should now know how to track down incoming and outgoing email delivery times from your Exim mail logs to help verify messages are actually being sent.

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 our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

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

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

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!