• v2.0.2 fa0b47d856

    v2.0.2 Stable

    kerem released this 2025-03-01 11:07:46 +03:00 | 0 commits to main since this release

    📅 Originally published on GitHub: Sat, 01 Mar 2025 08:08:26 GMT
    🏷️ Git tag created: Sat, 01 Mar 2025 08:07:46 GMT

    Version 2.0.2

    New Features:

    • Robust Connection Recovery with Backoff Strategy:

      • Implemented an exponential backoff strategy (capped at 5 minutes) for reconnecting after failures.
      • Improved connection lifecycle management to handle unstable network conditions.
    • Connection Health Status Tracking:

      • Monitors the health of IMAP connections to detect failures and take corrective actions.
      • Tracks last error messages and retry attempts for better diagnostics.
    • Watchdog Thread for Monitoring IMAP Threads:

      • A dedicated watchdog thread ensures that all IMAP threads remain responsive and automatically restarts any dead connections.
    • IDLE Timeouts and Periodic Connection Verifications:

      • Every 10 minutes, an IDLE timeout check is performed to verify the connection status.
      • NOOP commands are sent after email processing to confirm connection health.
    • New Prometheus Metrics:

      • reconnect_attempts_total: Tracks the number of reconnection attempts.
      • idle_timeouts_total: Counts occurrences of IDLE timeouts.
      • active_connections: Gauge metric indicating the number of active IMAP connections.
    • New Web API Endpoint for Resetting Connections:

      • Introduced /reset/<email_user>/<folder> to manually reset IMAP connections for specific accounts and folders.
    • Global Shutdown Flag:

      • Ensures a cleaner termination of the service by signaling all threads to exit gracefully.
    • Console Logging Handler:

      • Improved debugging visibility by adding a console logging option for real-time monitoring.
    • Configurable Maximum Retry Attempts and Backoff Strategy:

      • Allows fine-tuning of retry limits and backoff timing for better resilience in unstable environments.

    Bug Fixes:

    • IMAP Connection Freezing After Errors:

      • Fixed an issue where IMAP connections could freeze and become unresponsive after encountering certain errors.
    • Thread Deadlocks in Failed Connections:

      • Addressed deadlock scenarios where failed connections could cause entire threads to hang indefinitely.
    • Proper Release of Socket Resources:

      • Ensured that sockets are correctly released when errors occur, preventing resource exhaustion.
    • Improved Handling of IDLE Mode Disconnections:

      • Now properly detects and handles server disconnections during IDLE mode to avoid missed emails.
    • Prevented Email Processing on Unhealthy Connections:

      • Ensured that email fetching only occurs when connections are verified to be healthy.
    • Improved Error Handling in IMAP Operations:

      • Strengthened error handling in critical IMAP functions to avoid unexpected failures.
    • Proper Cleanup in Error Paths:

      • Ensured all temporary states and resources are cleaned up when errors occur.
    • Resolved Blocking Sockets Preventing Proper Shutdown:

      • Fixed an issue where certain socket operations could block indefinitely, preventing graceful shutdown.

    Changes:

    • Improved Error Handling with Contextual Logging:

      • Enhanced logging to provide more context on errors, including thread identification.
    • Enhanced Shutdown Sequence:

      • Ensured that all threads and network resources are properly cleaned up during termination.
    • Modified Initial Notification Test Behavior:

      • Startup no longer fails if the initial notification test encounters a warning; it now logs a warning instead of an error.
    • Enhanced /status API Endpoint:

      • The status endpoint now provides more detailed connection health information.
    • Translated Italian Comments to English:

      • Standardized all code comments in English for consistency.
    • Implemented Proper Retry System:

      • Added an exponential backoff mechanism for reconnections, improving reliability.

    Enhancements:

    • Improved Socket Resource Management:

      • Optimized the allocation and release of socket resources to prevent leaks.
    • Thread Safety During Shutdown:

      • Ensured that shutdown operations do not interfere with active threads.
    • Better Error Recovery and Resilience:

      • Improved handling of network failures to recover gracefully without service interruption.
    • Enhanced Email Fetching and Parsing Error Handling:

      • Strengthened parsing logic to handle edge cases and avoid crashes.
    • Improved Connection Lifecycle Management:

      • Ensured that connections are created, monitored, and closed in a structured manner.
    • Overall Stability in Unreliable Network Conditions:

      • Significant improvements in handling network timeouts, disconnections, and transient failures.
    Downloads
  • v2.0.1 cb99ce72fa

    v2.0.1 Stable

    kerem released this 2025-02-22 20:19:13 +03:00 | 2 commits to main since this release

    📅 Originally published on GitHub: Sat, 22 Feb 2025 17:20:04 GMT
    🏷️ Git tag created: Sat, 22 Feb 2025 17:19:13 GMT

    Version 2.0.1

    Enhancements:

    • Better TERM and CTRL+C support.
    • Better config.ini.sample.
    Downloads
  • v2.0 28084cc010

    v2.0 Stable

    kerem released this 2025-02-22 16:50:18 +03:00 | 6 commits to main since this release

    📅 Originally published on GitHub: Sat, 22 Feb 2025 13:51:33 GMT
    🏷️ Git tag created: Sat, 22 Feb 2025 13:50:18 GMT

    Version 2.0

    New Features:

    • Web Interface and API with Flask:

      • Introduced a Flask-based web interface providing endpoints for service status (/status), recent logs (/logs), and current configuration (/config).
      • The /status endpoint is publicly accessible and returns a simple status (OK or ERROR) indicating if all email accounts are connected and functioning properly.
      • When accessed with a valid API key, the /status endpoint provides detailed information about each monitored email account.
      • The /logs and /config endpoints require an API key for access and are secured to prevent unauthorized viewing of sensitive information.
    • Dynamic Configuration Reload:

      • Implemented the ability to reload the configuration without restarting the service by sending a SIGHUP signal to the process.
      • The service re-reads the config.ini file and updates its settings accordingly, allowing for dynamic adjustments.
    • Prometheus Metrics Integration:

      • Integrated Prometheus client to expose metrics for monitoring service performance.
      • Metrics include the total number of emails processed, notifications sent, processing time, and the number of errors encountered.
      • Metrics are available via an HTTP endpoint, configurable in the config.ini file.

    Enhancements:

    • Optional Support for Apprise:

      • Made the support for Apprise optional. If Apprise is not installed, the program continues to function using other notification providers (NTFY, Gotify, Pushover) without errors.
      • At startup, the program logs whether Apprise is available and adjusts functionality accordingly.
    • Configurable Flask and Prometheus Servers:

      • Both the Flask web interface and the Prometheus metrics server can now be enabled or disabled via the configuration file.
      • If FlaskHost and FlaskPort are not specified in config.ini, the Flask web interface will not start.
      • Similarly, if PrometheusHost and PrometheusPort are not specified, the Prometheus metrics server will not start.
      • This provides flexibility in deploying the service with only the desired features enabled.
    • Improved Security in Web Interface:

      • Implemented an API key mechanism for accessing sensitive endpoints (/config and /logs).
      • Sensitive information such as passwords, tokens, and URLs are redacted in the /config endpoint to prevent security breaches.
      • The /status endpoint provides detailed account information only when accessed with a valid API key.
    • Enhanced Logging:

      • The program now logs the availability of optional modules (Apprise, Flask, Prometheus) and indicates which features are active based on the configuration.
      • Improved logging practices to ensure that sensitive information (passwords, tokens) is never written to the logs.

    Changes:

    • Refined /status Endpoint Behavior:

      • The /status endpoint now returns a simple status (OK or ERROR) when accessed without an API key, suitable for monitoring systems.
      • When accessed with a valid API key, it provides detailed status information for each email account.
    • Conditional Module Imports:

      • The imports for Apprise, Flask, and Prometheus are now conditional.
      • If these libraries are not installed, the program continues to run without errors, and the associated features are automatically disabled.
      • This allows for a more customizable setup based on available dependencies.
    • Configuration File Updates:

      • Added new configuration options in config.ini under the [GENERAL] section:
        • FlaskHost and FlaskPort for configuring the Flask web interface.
        • PrometheusHost and PrometheusPort for configuring the Prometheus metrics server.
        • APIKey for securing access to sensitive API endpoints.
      • Updated the parsing logic to handle these new options and activate features accordingly.

    Upgrade Notes:

    • Configuration Update Required:

      • Update your config.ini file to include the new configuration options if you wish to use the Flask web interface and Prometheus metrics server.
      • Add the APIKey under the [GENERAL] section to secure access to the /config and /logs endpoints.
      • Existing configurations will continue to work, but adding the new options is necessary to enable the latest features.
    • Library Dependencies:

      • Install the Flask and prometheus_client libraries if you intend to use the web interface and Prometheus metrics.
    Downloads
  • v1.1 a982560625

    v1.1 Stable

    kerem released this 2024-11-18 22:31:14 +03:00 | 17 commits to main since this release

    📅 Originally published on GitHub: Mon, 18 Nov 2024 19:33:38 GMT
    🏷️ Git tag created: Mon, 18 Nov 2024 19:31:14 GMT

    Version 1.1

    New Features:

    • Per-Account Notification Providers:

      • Each email account can now have its own set of notification providers (Apprise, NTFY, Pushover, Gotify) configured separately from the global settings. This adds flexibility for account-specific notifications.
      • Added a parse_notification_providers() function to handle both global and account-specific notification setups.
    • Dynamic Notification Provider Configuration:

      • Ability to define notification providers globally or per account. If an account lacks its own configuration, it falls back to the global providers.
      • Enhanced handling of configuration sections in config.ini, allowing for custom notifications per account.
    • Refactoring of the IMAPHandler Class:

      • Now supports a notifier parameter to send notifications in case of errors or new messages, specific to the monitored account.

    Enhancements:

    • Configuration Validation:

      • Simplified validation to ensure at least one section starting with EMAIL exists, supporting multiple accounts seamlessly.
    • Improved Logging & Error Handling:

      • Enhanced error notifications for each account. If a connection error occurs during idle, a notification is sent via the account-specific notifier.
      • Increased granularity in notifications and logs to track specific connection errors and timeouts.
    • Extended Support for NTFY Notifications:

      • Improved support for NTFY, allowing optional authentication tokens for each configured URL.
      • Streamlined configuration handling for NTFY, Pushover, and Gotify to support multiple notification services.
    • Thread-Safe Email Processing:

      • Optimized the use of Lock within the MultiIMAPHandler class to ensure thread-safe email processing without conflicts.

    Changes:

    • Configuration (config.ini):

      • Added support for account-specific notifications (EMAIL:account sections).
      • [APPRISE], [NTFY], [PUSHOVER], and [GOTIFY] sections can now be defined globally or for individual accounts.
    • Improved test_config() Function:

      • Now tests both global and account-specific providers to ensure all configurations are correctly set up before starting the service.
    • Enhanced multi_account_main() Function:

      • Improved handling of multiple accounts with account-specific notifications. Accounts without dedicated providers will use the global notifier if available.

    Bug Fixes

    • IMAP Connection Stability:
      • Fixed an issue that caused premature disconnections from the IDLE mode under certain network conditions.

    Upgrade Notes:

    • Configuration:

      • Update your config.ini to include new sections for account-specific notification providers. See the new config.ini.sample for reference.
      • Existing configurations will continue to work, but adding the new sections is recommended to take full advantage of the latest features.
    Downloads
  • v1.0 7602b06224

    v1.0 Stable

    kerem released this 2024-07-02 15:49:33 +03:00 | 21 commits to main since this release

    📅 Originally published on GitHub: Tue, 02 Jul 2024 12:53:20 GMT
    🏷️ Git tag created: Tue, 02 Jul 2024 12:49:33 GMT

    Version 1.0

    New Features:

    • Log Rotation: Added support for log rotation. You can now configure log rotation based on size or time. This helps in managing log file sizes and ensures that old log files are archived.
    • Thread-Safe Email Processing: Improved the email processing to be thread-safe, ensuring that multiple email accounts can be processed simultaneously without conflicts.
    • Enhanced Configuration Validation: Added a validate_config function to ensure required sections are present in the config.ini file before proceeding.
    • Improved Logging: Introduced more robust logging mechanisms with options for size-based or time-based log rotation.

    Changes:

    • Logging Enhancements:
      • Introduced RotatingFileHandler and TimedRotatingFileHandler for better log management.
      • Updated the logging configuration to use parameters from config.ini for log rotation.
    • Codebase:
      • Refactored the DatabaseHandler class to use context management for better resource handling.
      • Added a Lock mechanism in the MultiIMAPHandler class to ensure thread-safe email processing.
      • Improved error handling and logging across the codebase to provide clearer insights and more robust operations.
    • Configuration (config.ini):
      • Introduced new configuration keys under [GENERAL]: LogRotationType, LogRotationSize, LogRotationInterval, and LogBackupCount for log rotation settings.

    Upgrade Notes:

    • To use the new log rotation feature, update the config.ini file to include the new [GENERAL] configuration keys related to log rotation.
    • Ensure that the config.ini file is properly validated using the new validation mechanism.
    Downloads