'\" te
.\"  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MAILSTATS 1 "Jun 24, 2004"
.SH NAME
mailstats \- print statistics collected by sendmail
.SH SYNOPSIS
.LP
.nf
\fBmailstats\fR [\fB-o\fR] [\fB-c\fR ] [\fB-C\fR \fIconfigfile\fR] [\fB-f\fR \fIstatisticsfile\fR]
     [\fB-p\fR] [\fB-P\fR]
.fi

.SH DESCRIPTION
.sp
.LP
The \fBmailstats\fR utility prints out the statistics collected by the
\fBsendmail\fR(1M) program on mailer usage. These statistics are collected if
the file indicated by the \fBStatusFile\fR configuration option of
\fBsendmail\fR (defined in \fB/etc/mail/sendmail.cf\fR) exists. The default
statistics file is \fB/etc/mail/statistics\fR.
.sp
.LP
To enable \fBmailstats\fR, you must, as root, touch \fB/etc/mail/statistics\fR.
See the \fBStatusFile\fR processing option in \fBsendmail\fR(1M).
.sp
.LP
\fBmailstats\fR first prints the time that the statistics file was created and
the last time it was modified. Then, the statistics for each mailer are
displayed on a single line, each with the following whitespace-separated
fields:
.sp
.ne 2
.na
\fBM\fR
.ad
.RS 14n
The mailer number.
.RE

.sp
.ne 2
.na
\fBmsgsfr\fR
.ad
.RS 14n
Number of messages from the mailer.
.RE

.sp
.ne 2
.na
\fBbytes_from\fR
.ad
.RS 14n
Kbytes from the mailer.
.RE

.sp
.ne 2
.na
\fBmsgsto\fR
.ad
.RS 14n
Number of messages to the mailer.
.RE

.sp
.ne 2
.na
\fBbytes_to\fR
.ad
.RS 14n
Kbytes to the mailer.
.RE

.sp
.ne 2
.na
\fBmsgsrej\fR
.ad
.RS 14n
Number of messages rejected by the mailer.
.RE

.sp
.ne 2
.na
\fBmsgsdis\fR
.ad
.RS 14n
Number of messages discarded by the mailer.
.RE

.sp
.ne 2
.na
\fBmsgsqur\fR
.ad
.RS 14n
Number of messages quarantined by the mailer.
.RE

.sp
.ne 2
.na
\fBMailer\fR
.ad
.RS 14n
The name of the mailer.
.RE

.sp
.LP
The display of statistics described above is followed by a separation line
containing only equal sign (\fB=\fR) characters. After the separation line, a
line preceded with a "\fBT\fR" and totaling the values for all of the mailers
is displayed. This is followed by another line preceded with a "\fBC\fR" that
lists the number of TCP connections.
.sp
.LP
To reinitialize the statistics file once a night, add an entry to root's
\fBcrontab\fR(1):
.sp
.in +2
.nf
mailstats -p > /dev/null
.fi
.in -2
.sp

.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-c\fR \fR
.ad
.RS 21n
Try to use \fBsubmit.cf\fR instead of the default \fBsendmail\fR configuration
file.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR \fIconfigfile\fR\fR
.ad
.RS 21n
Specify a \fBsendmail\fR configuration file.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR \fIstatisticsfile\fR\fR
.ad
.RS 21n
Specify a \fBsendmail\fR statistics file.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.RS 21n
Do not display the name of the mailer in the output.
.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 21n
Output information in program-readable mode and clear statistics.
.RE

.sp
.ne 2
.na
\fB\fB-P\fR\fR
.ad
.RS 21n
Output information in program-readable mode without clearing statistics.
.RE

.SH USAGE
.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBmailstats\fR
when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
.SH FILES
.sp
.ne 2
.na
\fB\fB/dev/null\fR\fR
.ad
.RS 25n
Zero-lined file
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/statistics\fR\fR
.ad
.RS 25n
Default \fBsendmail\fR statistics file
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/sendmail.cf\fR\fR
.ad
.RS 25n
Default \fBsendmail\fR configuration file
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Output Stability	Unstable
.TE

.SH SEE ALSO
.sp
.LP
\fBcrontab\fR(1), \fBcron\fR(1M), \fBsendmail\fR(1M), \fBattributes\fR(5),
\fBlargefile\fR(5)