GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
NOTIMAIL(1) FreeBSD General Commands Manual NOTIMAIL(1)

NotiMail - Monitor email inbox(es) and send notifications upon new email arrivals using various providers.

notimail [-c CONFIG] [--print-config] [--test-config] [--list-folders]

NotiMail is a script designed to monitor one or more email inboxes using the IMAP IDLE feature. It automatically processes new emails and sends notifications (including sender and subject) to various push notification providers. It supports multiple email accounts and folders, ensuring that emails are not processed repeatedly by using an SQLite database.

In addition, NotiMail now includes:

  • A web interface (via Flask) to display status, logs, and configuration.
  • Prometheus metrics export for detailed monitoring (emails processed, notifications sent, processing time, errors).
  • Dynamic configuration reload via SIGHUP (without restarting the service).
  • Robust startup checks with errors printed both to stdout and to the log.

Specify the path to the configuration file. Defaults to config.ini.
Print the current configuration from the config.ini file.
Test the configuration settings, including connectivity and notification providers.
List all the IMAP folders of the configured mailboxes.

Configuration is read from a file named config.ini. Ensure it is correctly set up before running NotiMail. The configuration file consists of multiple sections:

[GENERAL]:
Specifies general settings:
Path to the log file.
Path to the SQLite3 database for storing processed emails.
Type of log rotation (size or time).
Size threshold for log rotation (used if LogRotationType is size).
Time interval (in days) for log rotation (used if LogRotationType is time).
Number of backup log files to retain.
Hostname for the Prometheus metrics server.
Port for the Prometheus metrics server.
Hostname for the Flask web interface.
Port for the Flask web interface.
API key required to access secure web endpoints.
[EMAIL:accountX]:
Defines an email account (replace accountX with a unique identifier).
Email address for the account.
Password for the email account.
IMAP server hostname.
Comma-separated list of folders to monitor.
[NTFY]:
Settings for the NTFY notification provider.
NTFY URL for sending notifications (replace X with a unique number).
(Optional) Token for protected topics.
[PUSHOVER]:
Settings for the Pushover provider.
Pushover API token.
Pushover user key.
[GOTIFY]:
Settings for the Gotify provider.
Gotify URL for sending messages.
Gotify token.
[APPRISE]:
Settings for the Apprise provider.
Comma-separated list of Apprise service URLs.

NotiMail requires the following Python libraries:

  • imaplib
  • email
  • requests
  • configparser
  • time, socket
  • sqlite3
  • datetime
  • signal, sys
  • logging
  • argparse
  • threading
  • BytesParser (from email.parser)
  • apprise (optional, for additional notifications)
  • Flask (optional, for the web interface)
  • Prometheus Client (optional, for metrics export)

NotiMail runs from the command line and performs initial startup checks including:

  • Testing log file write access.
  • Testing database operations.
  • Sending a test notification via global providers.
If any startup check fails, an error message is printed to stdout and logged, and the program exits.

When enabled, the web interface provides:

/status
Displays the status of monitored email accounts (requires API key).
/logs
Shows the last 100 lines of the log file (requires API key).
/config
Returns the current configuration with sensitive values redacted (requires API key).

Prometheus metrics, if configured, export statistics such as:

Total number of emails processed.
Total number of notifications sent.
Time spent processing emails.
Total number of errors encountered.

NotiMail supports dynamic configuration reload. Sending a SIGHUP signal to the running process reloads config.ini without restarting the service:


kill -SIGHUP <process_id>

Additionally, standard signals (SIGTERM, SIGINT) are handled for graceful shutdown.

1. Running NotiMail with the default configuration:

notimail
2. Running NotiMail with a custom configuration file:
notimail -c /path/to/custom_config.ini
3. Printing the current configuration:
notimail --print-config
4. Testing the configuration settings:
notimail --test-config
5. Listing the IMAP folders for the configured mailboxes:
notimail --list-folders

Stefano Marinelli <stefano@dragas.it>

BSD 3-Clause License. See the source distribution for details.

IMAP IDLE(3), SQLite3(3), NTFY, Pushover, Gotify, Apprise, Flask, Prometheus Client.

22 February 2025

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.