Skip to main content

offlinemsmtp

Allows you to use msmtp offline by queuing email until you have an internet connection.

Lint and Build PyPi Version AUR Version LiberaPay Donation Status

Features

  • Runs as a daemon and (at a configurable time interval) attempts to send the mail in the queue directory.
  • Drop-in replacement for msmtp in your mutt config.
  • Only attempts to send the queued email message if it can connect to the configured SMTP server.
  • When a new email message comes into the queue and you are already online, offlinemsmtp will send it immediately.
  • Integrates with system notifications so that you are notified when mail is being sent.
  • Disable/enable sending of mail by the presence/absence of a file. This is useful if you want to have some sort of "offline mode".

Installation

Using PyPi:

pip install --user offlinemsmtp

On Arch Linux, you can install the offlinemsmtp package from the AUR. For example, if you use yay:

yay -S offlinemsmtp

Run the daemon using systemd

Create a file called ~/.config/systemd/user/offlinemsmtp.service with the following content (if you installed via the AUR package, a service file was already created for you in /usr/lib/systemd/user so you only need to do this step if you want to customize the parameters passed to the daemon):

[Unit]
Description=offlinemsmtp

[Service]
ExecStart=/usr/bin/offlinemsmtp --daemon

[Install]
WantedBy=default.target

Then, enable and start offlinemsmtp using systemd:

systemctl --user daemon-reload
systemctl --user enable --now offlinemsmtp

Usage

offlinemsmtp has two components: a daemon for listening to the outbox folder and sending the mail when the network is available and a enqueuer for adding mail to the send queue.

To run the daemon in the current command line (this is useful for testing), run this command::

offlinemsmtp --daemon

To enqueue emails, use the offlinemsmtp executable without --daemon. All parameters (with a few caveats described below in Command Line Arguments) are forwarded on to msmtp. Anything passed in via standard in will be forwarded over standard in to msmtp when the mail is sent.

Configuration with Mutt

To use offlinemsmtp with mutt, just replace msmtp in your mutt configuration file with offlinemsmtp. Here is an example:

set sendmail = "offlinemsmtp -a personal"

Command Line Arguments

offlinemsmtp accepts a number of command line arguments:

  • -h, --help - shows a help message and exits.
  • -o DIR, --outbox-directory DIR - set the directory to use as the outbox. Defaults to ~/.offlinemsmtp-outbox.
  • -d, --daemon - run the offlinemsmtp daemon.
  • -s, --silent - set to disable all logging and notifications.
  • -i INTERVAL, --interval INTERVAL - set the interval (in seconds) at which to attempt to flush the send queue. Defaults to 60.
  • -C FILE, --file FILE - the msmtp configuration file to use.
  • --send-mail-file FILE - only send mail if this file exists (defaults to None meaning that no file is required for mail sending to be enabled)
  • All remaining arguments are passed to msmtp. The -C argument is automatically passed to msmtp.
  • Anything after a special -- argument will be passed to msmtp. This allows you to pass arguments that may conflict with offlinemsmtp arguments to msmtp.

Contributing

See the CONTRIBUTING.md document for details on how to contribute to the project.

Other projects

Release files for offlinemsmtp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for offlinemsmtp 0.4.0
File Size Uploaded
offlinemsmtp-0.4.0.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for offlinemsmtp 0.4.0
File Interpreter ABI Platform
offlinemsmtp-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / offlinemsmtp-0.4.0.tar.gz

Download URL offlinemsmtp-0.4.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a9d2ad77676458c04614f2019611a56ca585e80b62c1d9c4ba3571bb451761f4
BLAKE2b-256 checksum
How to use checksums
b4d81b4647e065cc0b96576b38b2fd37168727a9777ea124e784d3d6f65d1020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.9.15 Linux/5.15.0-1022-azure

Release files / offlinemsmtp-0.4.0-py3-none-any.whl

Download URL offlinemsmtp-0.4.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bd5e159409f1215acf59dd29c40786a689819802cfe71d557bd5fb7f0cc5d4c
BLAKE2b-256 checksum
How to use checksums
5dd33791bc1e8afafe50539dab4d62af5a07c7e34d488e02a33da106cb0cc673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.9.15 Linux/5.15.0-1022-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page