If you are using opensmtpd on a device not always connected on the internet, you may want to see what mail did not go, and force it to be delivered NOW when you are finally connected to the Internet.
We can use smtpctl to show the current queue.
$ doas smtpctl show queue 1de69809e7a84423|local|mta|auth|so@tld|dest@tld|dest@tld|1540362112|1540362112|0|2|pending|406|No MX found for domain
The previous command will report nothing if the queue is empty.
In the previous output, we see that there is one mail from me to dest@tld which is pending due to “NO MX found for domain” (which is normal as I had no internet when I sent the mail).
We need to extract the first field, which is 1de69809e7a84423 in the current example.
In order to tell opensmtpd to deliver it now, we will use the following command:
$ doas smtpctl schedule 1de69809e7a84423 1 envelope scheduled $ doas smtpctl show queue
My mail was delivered, it’s not in the queue anymore.
If you wish to deliver all enveloppes in the queue, this is as simple as:
$ doas smtpctl schedule all