1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
.\" $OpenBSD: smtpctl.8,v 1.44 2013/07/20 06:45:12 jmc Exp $
.\"
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
.\" Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 20 2013 $
.Dt SMTPCTL 8
.Os
.Sh NAME
.Nm smtpctl
.Nd control the Simple Mail Transfer Protocol daemon
.Sh SYNOPSIS
.Nm
.Ar command
.Op Ar argument ...
.Sh DESCRIPTION
The
.Nm
program controls
.Xr smtpd 8 .
Commands may be abbreviated to the minimum unambiguous prefix; for example,
.Cm sh s
for
.Cm show stats .
.Pp
The following commands are available:
.Bl -tag -width Ds
.It Cm log brief
Disable verbose debug logging.
.It Cm log verbose
Enable verbose debug logging.
.It Cm monitor
Display updates of some
.Xr smtpd 8
internal counters in one second intervals.
Each line reports the increment of all counters since the last update,
except for some counters which are always absolute values.
The first line reports the current value of each counter.
The fields are:
.Pp
.Bl -bullet -compact
.It
Current number of active SMTP clients (absolute value).
.It
New SMTP clients.
.It
Disconnected clients.
.It
Current number of envelopes in the queue (absolute value).
.It
Newly enqueued envelopes.
.It
Dequeued envelopes.
.It
Successful deliveries.
.It
Temporary failures.
.It
Permanent failures.
.It
Message loops.
.It
Expired envelopes.
.It
Envelopes removed by the administrator.
.It
Generated bounces.
.El
.It Cm pause envelope Ar envelope-id | message-id
Temporarily suspend scheduling for the envelope with the given ID,
or all envelopes with the given message ID.
.It Cm pause mda
Temporarily stop deliveries to local users.
.It Cm pause mta
Temporarily stop relaying and deliveries to
remote users.
.It Cm pause smtp
Temporarily stop accepting incoming sessions.
.It Cm profile Ar subsystem
Enables real-time profiling of
.Ar subsystem .
Supported subsystems are:
.Pp
.Bl -bullet -compact
.It
queue, to profile cost of queue IO
.It
imsg, to profile cost of event handlers
.El
.It Cm remove Ar envelope-id | message-id
Remove a single envelope, or all envelopes with the same message ID.
.It Cm resume envelope Ar envelope-id | message-id
Resume scheduling for the envelope with the given ID,
or all envelopes with the given message ID.
.It Cm resume mda
Resume deliveries to local users.
.It Cm resume mta
Resume relaying and deliveries to remote users.
.It Cm resume route Ar route-id
Resume routing on disabled route
.Ar route-id .
.It Cm resume smtp
Resume accepting incoming sessions.
.It Cm schedule all
Mark all envelopes as ready for immediate delivery.
.It Cm schedule Ar envelope-id | message-id
Mark a single envelope, or all envelopes with the same message ID,
as ready for immediate delivery.
.It Cm show envelope Ar envelope-id
Display envelope content for the given ID.
.It Cm show hoststats
Display status of last delivery for domains that have been active in the
last 4 hours.
It consists of the following fields, separated by a "|":
.Pp
.Bl -bullet -compact
.It
Domain.
.It
.Ux
timestamp of last delivery.
.It
Status of last delivery.
.El
.It Cm show message Ar envelope-id
Display message content for the given ID.
.It Cm show queue
Display information concerning envelopes that are currently in the queue.
Each line of output describes a single envelope.
It consists of the following fields, separated by a "|":
.Pp
.Bl -bullet -compact
.It
Envelope ID.
.It
Address family of the client which enqueued the mail.
.It
Type of delivery: one of "mta", "mda" or "bounce".
.It
Various flags on the envelope.
.It
Sender address (return path).
.It
The original recipient address.
.It
The destination address.
.It
Time of creation.
.It
Time of expiration.
.It
Time of last delivery or relaying attempt.
.It
Number of delivery or relaying attempts.
.It
Current runstate: either "pending" or "inflight" if
.Xr smtpd 8
is running, or "offline" otherwise.
.It
Delay in seconds before the next attempt if pending, or time ellapsed
if currently running.
This field is blank if
.Xr smtpd 8
is not running.
.It
Error string for the last failed delivery or relay attempt.
.El
.It Cm show routes
Display status of routes currently known by
.Xr smtpd 8 .
Each line consists of a route number, a source address, a destination
address, a set of flags, the number of connections on this
route, the current penalty level which determines the amount of time
the route is disabled if an error occurs, and the delay before it
gets re-activated.
The following flags are defined:
.Pp
.Bl -tag -width xx -compact
.It D
The route is currently disabled.
.It N
The route is new.
No SMTP session has been established yet.
.It Q
The route as a timeout registered to lower its penalty level and possibly
re-activate or discard it.
.El
.It Cm show stats
Displays runtime statistics concerning
.Xr smtpd 8 .
.It Cm stop
Stop the server.
.It Cm trace Ar subsystem
Enables real-time tracing of
.Ar subsystem .
Supported subsystems are:
.Pp
.Bl -bullet -compact
.It
imsg
.It
io
.It
smtp (incoming sessions)
.It
filter
.It
transfer (outgoing sessions)
.It
bounce
.It
scheduler
.It
expand (aliases/virtual/forward expansion)
.It
lookup (user/credentials lookups)
.It
stat
.It
rules (matched by incoming sessions)
.It
mproc
.It
all
.El
.It Cm unprofile Ar subsystem
Disables real-time profiling of
.Ar subsystem .
.It Cm untrace Ar subsystem
Disables real-time tracing of
.Ar subsystem .
.It Cm update table Ar name
For table backends that provide caching, causes
.Xr smtpd 8
to update the cache.
.El
.Pp
When
.Nm smtpd
receives a message, it generates a
.Ar message-id
for the message, and one
.Ar envelope-id
per recipient.
The
.Ar message-id
is a 32-bit random identifier that is guaranteed to be
unique on the host system.
The
.Ar envelope-id
is a 64-bit unique identifier that encodes the
.Ar message-id
in the 32 upper bits and a random envelope identifier
in the 32 lower bits.
.Pp
A command which specifies a
.Ar message-id
applies to all recipients of a message;
a command which specifies an
.Ar envelope-id
applies to a specific recipient of a message.
.Sh FILES
.Bl -tag -width "/var/run/smtpd.sockXX" -compact
.It /var/run/smtpd.sock
.Ux Ns -domain
socket used for communication with
.Xr smtpd 8 .
.El
.Sh SEE ALSO
.Xr smtpd 8
.Sh HISTORY
The
.Nm
program first appeared in
.Ox 4.6 .
|