Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Does anyone know of a utility of that would give me the total number of email messages sent by sendmail, using old maillogs ?

Someone suggested the use of the mailstats utility, however this program seems to give the statistical information for all mail log file entries. Though this is beneficial, it's not helpful on this case since a single mail message sent by sendmail can log anywhere to 5 different log entries.

share|improve this question

Does grep 'Message accepted for delivery' /var/log/maillog| wc -l provide the number you need?

share|improve this answer
Is the string 'Message accepted for delivery' the standard sendmail log entry for successful messages? If so then this is what I was looking for. -Tony – Alpha01 Sep 20 '11 at 21:29

You can use grep -c to count the number of matching lines instead of pipe grep to wc -l:

grep -c "Message accepted for delivery" /var/log/maillog
share|improve this answer
Neat trick! It's much faster than piping! On a 2GB file it ran in 1/3 the time. – Aaron Copley Jan 4 '12 at 0:35

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.