Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
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  us-
       ing  the	 IMAP IDLE feature.  It	automatically processes	new emails and
       sends notifications (including sender and subject) to various push  no-
       tification  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 restart-
		     ing 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 con-
	      fig.ini.

       --print-config
	      Print the	current	configuration from the config.ini file.

       --test-config
	      Test the configuration settings, including connectivity and  no-
	      tification 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 cor-
       rectly set up before running NotiMail.  The configuration file consists
       of multiple 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	LogRo-
		     tationType	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
       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:

	      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  ser-
       vice:

	   kill	-SIGHUP	<process_id>

       Additionally, standard signals (SIGTERM,	SIGINT)	are handled for	grace-
       ful 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)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=notimail&sektion=1&manpath=FreeBSD+Ports+14.3.quarterly>

home | help