| Crates.io | midnight |
| lib.rs | midnight |
| version | 0.4.0 |
| created_at | 2025-10-22 23:58:07.723188+00 |
| updated_at | 2026-01-09 01:29:53.258345+00 |
| description | Send mail later via batch queueing |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1896416 |
| size | 41,693 |
Schedule emails to be sent at a later time via at(1).
cargo install midnight
git clone https://library.cat/rory/midnight
cd midnight
cargo install --path .
You will also need at on your system. If you do not have it, grab it
from your package manager.
If you are on macOS, the at daemon is not enabled by default, so you
will need to run the following command to enable and start it:
sudo launchctl enable system/com.apple.atrun
In your neomutt config, assign a macro to call the binary. Make sure it's in your path somewhere.
macro index,pager L "|midnight<enter>" "send later"
You must also ensure that you are using pipe_decode = no somewhere in
your neomutt config, as midnight uses the message ID to send your
email (setting pipe_decode strips the message ID). This ensures your
scheduled (queued) messages get sent, even if you decide to edit their
contents before they are delivered.
Depending on your setup, it may be possible to define a macro that works from the compose menu. You may need to set a separate macro per account, if your accounts use different names for the draft boxes. Something like the command below will likely work:
macro compose L "<postpone-message><enter><change-folder>=Drafts<enter>|midnight<enter>"
This seems to function ok in my setup, as the lastest postponed message is always be the first message my cursor lands on when switching to the drafts box. However, this may not be the case for you, depending on some other options in your neomutt config. So, please be careful, and test this yourself before relying on it.
You may specify which draftbox an account is associated with, using a
.draftboxes file. If you do not specify a .draftboxes files, midnight
will grep around your neomutt config directory, and attempt to find the
correct draftbox using the postponed = ... option inside a neomutt
config file. If you use multiple accounts, you must have a separate file
for each account for this to work properly. An example .draftboxes is
below. Lines starting with '#' are comments.
# ~/.config/neomutt/.draftboxes
noreply@example.com = ~/mail/example.com/drafts
notarealaddress@crates.io = ~/mail/crates.io/draftbox
Installing midnight will give you access to the following programs:
midnight: Used to add a message to the queue. Primarily intended to
be used from neomutt via a macro. See the Configuration section
above for details.mn: Alias for midnight.mnq: List mail that's been scheduled for delivery.mnrm: Remove a scheduled mail from the queue by passing it's job ID
(this ID appears in mnq as the first value, between square
brackets).mnsend: Send a message using a unique message ID. This program is
not intended to be called by the user, but rather, is used by midnight
internally when creating a new job in at(1).You can run midnight -h to get a help menu that displays proper
program usage, as well as some optional flags. The flags may be used
with any of the binaries listed above, and may override that binary's
default behavior.
On the compose screen, use P to postpone the message. Then, go to your
drafts folder, and use the macro you set above to schedule the message
to be sent later (or see the Advanced configuration section on
possibly setting a macro to send later directly from the compose menu).
You will be prompted to enter a time at which to schedule the message
for delivery. You may enter any time that can be interpreted by at(1).
For instance:
See man at for more details. If the time you enter is unable to be
interpreted properly, the program will quit with an error message, and
your email will not be added to the queue.
This software is in a beta release, and there are some quircks and missing features for the time being:
folder and postponed values inside of your config. If you
don't have separate files for each account, then for now, you will need
to either refactor your config, or change the source code of the program
so it works with your setup.midnight will first
try to look for this file, then fallback to grepping your neomutt config
if this file cannot be found.midnight keeps some metadata in it's own queue file. By default, it's
stored in NEOMUTT_XDG_CONFIG_DIR/.midnight. Additionally, calling
mnrm <jobid> will also remove the job from atq(1).Advanced configuration section for more details.mnsend
instead of invoking neomutt in at(1) directly, we now (attempt) to
delete the message in the user's draftbox after it is sent.git clone https://library.cat/rory/midnight
cd midnight
cargo build