Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The back story here is that I would like to start using an SMTP service to start sending my email (currently sent though sendmail running locally on the server), but in order to get a good idea of what this will cost I need to understand how many messages I am sending.

The best way I can think of to get a round figure is the sendmail logs- but I'm not sure exactly how to do this.

I do know that a single message usually (if not always) has multiple lines- if I knew how they were associated together I could write something to parse the log and count uniques (????).

Since I don't know what that is I am trying to figure out how to identify 1 record for each actual request and count those...

sudo cat maillog.* | grep 'mailer=relay' | grep '@' | wc

This amounts to about about 1/7th of the total lines in the logs, which conversely suggests that a message has an average of 7 records.

Is this a reasonable way to do this? Is there a better way?

Thanks as always!

share|improve this question

You could try using the mailstats program, typically part of the Sendmail distribution.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.