SMTPCTL(8)

πŸ“¦
version 7.9.0p0 Β· 2 versions
, in epel 10, fedora 43, fedora 44

πŸ’Œ 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 from top(1) and ps(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 some 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:
    • 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 IO
    • imsg, 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" if smtpd(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 by 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 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 concerning smtpd(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:
    • imsg
    • io
    • smtp (incoming sessions)
    • filters
    • mta (outgoing sessions)
    • bounce
    • scheduler
    • expand (aliases/virtual/forward expansion)
    • lookup (user/credentials lookups)
    • stat
    • rules (matched by incoming sessions)
    • mproc
    • all
  • 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 with smtpd(8). πŸ”Œ

🌈 SEE ALSO 🌈

smtpd(8)


⭐ 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