Sendmail Statistics with mailstats

On VPS2 or a dedicated mail server, you can display the server's sendmail statistics by typing the command "mailstats", without parameters.

On a VPS1, however, you must do the following:

You should see something like the following

Statistics from Mon Jun 25 14:32:41 2001
 M   msgsfr  bytes_from   msgsto    bytes_to  msgsrej msgsdis  Mailer
 0        0          0K     6491      21036K        0       0  prog
 1        0          0K        1          4K        0       0  *file*
 3    13925     132391K     2795       3607K      158       0  local
 4        1          1K        0          0K        0       0  smtp
 5     7944     131541K   101787     834030K      719       0  esmtp
 8        0          0K        4          4K        0       0  relay
 9     7730     283951K    10446     409609K       27       0  procmail
 T    29600     547884K   121524    1268290K      904       0
 C    29600               121524                 1133

The above output is tallied from information in the sendmail "statistics" file. On the VPS1, the statistics file is named ~/etc/

Unless you have "cleared" the statistics file, it will show statistics from the time you first provisioned your account until now. The statistics will probably be more informative if you clear the file periodically--every day, week or month, for example. You can clear the file by issuing

% cp /dev/null ~/etc/ 

or any command to remove or rename the file. If the file is not present, sendmail will not create a new one, so if you delete or rename the file, you need to create a new (empty) one with the command

% touch ~/etc/

Output Format


(The following is from the mailstats man page.)

MThe mailer number.
msgsfrNumber of messages from the mailer.
bytes_fromKbytes from the mailer.
msgstoNumber of messages to the mailer.
bytes_toKbytes to the mailer.
msgsrejNumber of messages rejected.
msgsdisNumber of messages discarded.
MailerThe name of the mailer.


Here are some of the Mailers (also called Delivery Agents or Mail Delivery Agents) you might see mentioned in the right column of mailstats output. (Mailers appear in the file on lines that begin with an uppercase "M".)

The program mailer delivers mail to programs (introduced by a vertical bar on the right-hand-side of aliases entries). Some examples are majordomo's wrapper program, autoreply and vacation.
This mailer is used when sendmail delivers mail to files (not including local mailboxes, which are delivered to by the local mailer) named on the right-hand-side of the aliases file. Delivery to the special file /dev/null uses this mailer.
The local mailer delivers incoming mail to the mailboxes of local users.
The esmtp ("Extended Simple Mail Transfer Protocol") mailer is called to send mail to another mail server somewhere on the Internet.