FreeBSD Manual Pages
NOTIMAIL(1) General Commands Manual NOTIMAIL(1) NAME NotiMail - Monitor email inbox(es) and send notifications upon new email arrivals using various providers. SYNOPSIS notimail [-c CONFIG] [--print-config] [--test-config] [--list-folders] DESCRIPTION NotiMail is a script designed to monitor one or more email inboxes using the IMAP IDLE feature. It automatically processes new emails and sends no- tifications (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 con- figuration. * 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. OPTIONS -c, --config CONFIG Specify the path to the configuration file. Defaults to config.ini. --print-config Print the current configuration from the config.ini file. --test-config Test the configuration settings, including connectivity and notifi- cation providers. --list-folders List all the IMAP folders of the configured mailboxes. CONFIGURATION Configuration is read from a file named config.ini. Ensure it is correctly set up before running NotiMail. The configuration file consists of multi- ple sections: [GENERAL]: Specifies general settings: LogFileLocation: Path to the log file. DataBaseLocation: Path to the SQLite3 database for storing processed emails. LogRotationType: Type of log rotation (size or time). LogRotationSize: Size threshold for log rotation (used if LogRotationType is size). LogRotationInterval: Time interval (in days) for log rotation (used if LogRota- tionType is time). LogBackupCount: Number of backup log files to retain. PrometheusHost: Hostname for the Prometheus metrics server. PrometheusPort: Port for the Prometheus metrics server. FlaskHost: Hostname for the Flask web interface. FlaskPort: Port for the Flask web interface. APIKey:API key required to access secure web endpoints. [EMAIL:accountX]: Defines an email account (replace accountX with a unique identifier). EmailUser: Email address for the account. EmailPass: Password for the email account. Host: IMAP server hostname. Folders: Comma-separated list of folders to monitor. [NTFY]:Settings for the NTFY notification provider. UrlX: NTFY URL for sending notifications (replace X with a unique number). TokenX:(Optional) Token for protected topics. [PUSHOVER]: Settings for the Pushover provider. ApiToken: Pushover API token. UserKey: Pushover user key. [GOTIFY]: Settings for the Gotify provider. Url: Gotify URL for sending messages. Token: Gotify token. [APPRISE]: Settings for the Apprise provider. urls: Comma-separated list of Apprise service URLs. DEPENDENCIES 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) USAGE NotiMail runs from the command line and performs initial startup checks in- cluding: * 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: /statusDisplays the status of monitored email accounts (requires API key). /logs Shows the last 100 lines of the log file (requires API key). /configReturns the current configuration with sensitive values redacted (requires API key). Prometheus metrics, if configured, export statistics such as: emails_processed_total Total number of emails processed. notifications_sent_total Total number of notifications sent. email_processing_seconds Time spent processing emails. errors_total Total number of errors encountered. SIGNALS 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. EXAMPLES 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 AUTHOR Stefano Marinelli <stefano@dragas.it> LICENSE BSD 3-Clause License. See the source distribution for details. SEE ALSO IMAP IDLE(3), SQLite3(3), NTFY, Pushover, Gotify, Apprise, Flask, Prometheus Client. 22 February 2025 NOTIMAIL(1)
NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFIGURATION | DEPENDENCIES | USAGE | SIGNALS | EXAMPLES | AUTHOR | LICENSE | SEE ALSO
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=notimail&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>
