SMTPCTL(8)
π SMTPCTL(8) β the smtpctl + mailq era π
okay bestie, welcome to the manual page for smtpctl and mailq, straight out of the System Manager's Manual. this is the lil remote control for your SMTP daemon and honestly? it's giving main character energy. let's get into it π
β¨ NAME β¨
smtpctl, mailq β control the SMTP daemon π¦
πΈ SYNOPSIS πΈ
smtpctl command [argument ...]
mailq
π DESCRIPTION π
so smtpctl is the program that controls smtpd(8). that's the whole vibe. π
Commands can be abbreviated to the minimum unambiguous prefix β like, you don't have to type the whole thing, just enough that it can't be confused with anything else. for example, sh ro works for show routes. iykyk π
The mailq command is there for compatibility with other MTAs, and it's literally just a shortcut for show queue. that's it. that's the whole command. no cap.
Here's every command you can run, no skips, no cuts, all of them π«Ά
discover envelope-id | message-idβ schedule a single envelope, or all the envelopes sharing the same message ID that got manually moved into the queue. β¨encrypt [string]β encrypts the password string into a representation that's suitable for user credentials, then prints it to standard output. If you don't pass string, it reads cleartext passwords from standard input instead. π
β οΈ bestie please β it is advised to avoid providing the password as a parameter, because it will be visible fromtop(1)andps(1)output. like, everyone can see it. do not do that. π
log briefβ disable verbose debug logging. π€«log verboseβ enable verbose debug logging. π£οΈmonitorβ display updates of somesmtpd(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:- Current number of active SMTP clients (absolute value).
- New SMTP clients.
- Disconnected clients.
- Current number of envelopes in the queue (absolute value).
- Newly enqueued envelopes.
- Dequeued envelopes.
- Successful deliveries.
- Temporary failures.
- Permanent failures.
- Message loops.
- Expired envelopes.
- Envelopes removed by the administrator.
- Generated bounces.
pause envelope envelope-id | message-id | allβ temporarily suspend scheduling for the envelope with the given ID, the envelopes with the given message ID, or all envelopes. βΈοΈpause mdaβ temporarily stop deliveries to local users.pause mtaβ temporarily stop relaying and deliveries to remote users.pause smtpβ temporarily stop accepting incoming sessions.profile subsystemβ enables real-time profiling of subsystem. Supported subsystems are:queue, to profile cost of queue IOimsg, to profile cost of event handlers
remove envelope-id | message-id | allβ remove a single envelope, envelopes with the given message ID, or all envelopes. ποΈresume envelope envelope-id | message-id | allβ resume scheduling for the envelope with the given ID, envelopes with the given message ID, or all envelopes. βΆοΈresume mdaβ resume deliveries to local users.resume mtaβ resume relaying and deliveries to remote users.resume route route-idβ resume routing on disabled route route-id.resume smtpβ resume accepting incoming sessions.schedule envelope-id | message-id | allβ mark as ready for immediate delivery a single envelope, envelopes with the given message ID, or all envelopes. πshow envelope envelope-idβ display envelope content for the given ID.show hostsβ display the list of known remote MX hosts. For each of them, it shows the IP address, the canonical hostname, a reference count, the number of active connections to this host, and the elapsed time since the last connection. π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"|":- Domain.
- Ux timestamp of last delivery.
- Status of last delivery.
show message envelope-idβ display message content for the given ID.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"|":- Envelope ID.
- Address family of the client which enqueued the mail.
- Type of delivery: one of
"mta","mda"or"bounce". - Various flags on the envelope.
- Sender address (return path).
- The original recipient address.
- The destination address.
- Time of creation.
- Time of expiration.
- Time of last delivery or relaying attempt.
- Number of delivery or relaying attempts.
- Current runstate: either
"pending"or"inflight"ifsmtpd(8)is running, or"offline"otherwise. - Delay in seconds before the next attempt if pending, or time elapsed if currently running. This field is blank if
smtpd(8)is not running. - Error string for the last failed delivery or relay attempt.
show relaysβ display the list of currently active relays and associated connectors. For each relay, it shows a number of counters and information on its internal state on a single line. Then comes the list of connectors (source addresses to connect from for this relay). πshow routesβ display status of routes currently known bysmtpd(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 reactivated. The following flags are defined:Dβ The route is currently disabled.Nβ The route is new. No SMTP session has been established yet.Qβ The route has a timeout registered to lower its penalty level and possibly reactivate or discard it.
show statsβ displays runtime statistics concerningsmtpd(8). πshow statusβ shows if MTA, MDA and SMTP systems are currently running or paused.spf walkβ recursively look up SPF records for the domains read from stdin. For example:
$ smtpctl spf walk < domains.txt
π§ SPF records may contain macros which cannot be included in a static list and must be resolved dynamically at connection time. spf walk cannot provide full results in these cases. so like, know the limits, bestie.
trace subsystemβ enables real-time tracing of subsystem. Supported subsystems are:imsgiosmtp(incoming sessions)filtersmta(outgoing sessions)bounceschedulerexpand(aliases/virtual/forward expansion)lookup(user/credentials lookups)statrules(matched by incoming sessions)mprocall
unprofile subsystemβ disables real-time profiling of subsystem.untrace subsystemβ disables real-time tracing of subsystem.update table nameβ updates the contents of table name, for tables using the"file"backend.
okay so here's the lore on IDs, because this part is important:
When smtpd receives a message, it generates a message-id for the message, and one envelope-id per recipient.
The message-id is a 32-bit random identifier that is guaranteed to be unique on the host system. β¨
The envelope-id is a 64-bit unique identifier that encodes the message-id in the 32 upper bits and a random envelope identifier in the 32 lower bits. like, it's nested. it's iconic. π
A command which specifies a message-id applies to all recipients of a message; a command which specifies an envelope-id applies to a specific recipient of a message. π«Ά
π FILES π
/run/smtpd.sockβ Ux-domain socket used for communication withsmtpd(8). π
π SEE ALSO π
β HISTORY β
The smtpctl program first appeared in OpenBSD 4.6. a true legend, honestly. π
and that's the whole page bestie!! this beauty came from the System Manager's Manual, page SMTPCTL(8), and the footer date on this one is $Mdocdate: March 2 2023 $ β so like, if you're reading this from the future, hi, the vibes are still immaculate. πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- epel 10: opensmtpd 7.9.0p0-1.el10_3 Β· ISC
- fedora 43: opensmtpd 7.7.0p0-3.fc43 Β· ISC
- fedora 43: opensmtpd 7.8.0p0-1.fc43 Β· ISC
- fedora 44: opensmtpd 7.8.0p0-2.fc44 Β· ISC
- fedora 44: opensmtpd 7.9.0p0-1.fc44 Β· ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms