# Postfix: How to monitor in/out emails?



## klabacita (Mar 29, 2011)

Hi people.

 Last week I receive a call from a user complaining that some emails she send didn't reach the other end.

 I check my logs and found that she was right, for some reason she had only the email she send in his "Sent" folder but didn't see any log that say "sent" or "deliver" to the other end's.

 1 email was for local user and the other for a external user, what attract my attention was that even the local user didn't receive the email.

 Well, them I start turning on the debug flags on postfix and see if we have issue inside, but what happen with the email, it went to a black-hole?

 My questions will be: How do u people are monitoring postfix to detect this issues? How are u attacking this behaviors? Is me the only one with a issue like this one?

 We are using Postfix 2.8.x on FreeBSD 8.2, thanks!!!


----------



## kpa (Mar 29, 2011)

Is the message still in the outgoing queue waiting for delivery? Can you find the message in the output of
`# postqueue` ?

One possibility is that the message has a typo in the recipient address and the message is stuck in the queue because it is undeliverable.
Another one is that the domain of the recipient has broken mx records and that makes the message undeliverable as well.


----------



## gkontos (Mar 29, 2011)

In the past I had some retarded questions like... someone send me an email yesterday but I haven't received it yet, is there something wrong with our mailserver?

For outgoing mails you can monitor the que of postfix with pfqueue. But /var/log/maillog is your real friend.


----------



## klabacita (Mar 29, 2011)

Thanks guys for your info.

 I had read very carefully the maillog but I didn't see any issue just that for some reason doesn't exist any log that say "deliver" "sent" for the other end.

 The queue is clean, just 2 messages and none if them are related with the issue.

 All this week I will be monitoring the mail server to see if we see issue on it.

 Thanks!!!


----------



## mamalos (Apr 4, 2011)

If you see no records in /var/log/maillog with regard to the emails your user claims to have sent, then your user has never sent these emails through your mail server. Check your logs thoroughly to match the records associated with the emails that concern you (sender, receiver, time of day). Use a combination of *tail -n <numoflines>* and *grep* if your server is busy and your logs are huge, it won't take you more than 1 minute to track the mail of interest. There is *NO* way these records don't exist even in the default *postfix* setup. The only black holes in *MTA*s are the queues, and *gkontos* and *kpa* have given you alternatives to monitor their contents. Of course, keep in mind that the mails contained in these queues are stored in /var/spool/postfix folder, depending on your setup (the queue_directory directive is responsible for this location).


----------

