Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memorydelaysmtphandler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memorydelaysmtphandler

MemoryDelaySmtpHandler will create a bundle of events in a single email and sent it after a delay.

  • 1.0.2
  • PyPI
  • Socket score

Maintainers
1

memorydelaysmtphandler

Overview

memorydelaysmtphandler adds new handlers for the Python logging package.

Issue : SMTPHandler sends one email after each event. Multiple emails can be received in a short time.
Improvement : MemoryDelaySmtpHandler will create a bundle of events in a single email and sent it after a delay.

Features

MemoryDelayHandler class adds an auto-flush delay to logging.handlers.MemoryHandler.
MemoryDelaySmtpHandler class adds an auto-flush delay to logging.handlers.SMTPHandler.

The handler is flushed when:
  • the number of events is equal to the capacity
  • the event of a certain severity occurs
  • after a first event, the delay is reached
New parameters
  • Initializes the handler with a buffer of the specified capacity. Here, capacity means the number of events records buffered.
  • A delay in seconds to automatically flush the buffer after a first event. When the delay argument is not present or None, no automatic flushed is provided.

Installation

$ python3 -m pip install memorydelaysmtphandler

Using with OpenCanary

logging.handlers.SMTPHandler sends one email after each alert. Multiple emails can be received in a short time.
MemoryDelaySmtpHandler will create a bundle of alerts in a single email and sent it after a delay.

Installation for OpenCanary

Install memorydelaysmtphandler in the OpenCanary environment.

Edit /etc/opencanaryd/opencanary.conf

Change "class": "logging.handlers.SMTPHandler"
by "class": "memorydelaysmtphandler.memorydelaysmtphandler.MemoryDelaySmtpHandler"

add these parameters:

	"capacity" : your capacity,
	"delay" : your delay

Example:

// [..] # Services configuration
    "logger": {
    "class" : "PyLogger",
    "kwargs" : {
        "handlers": {
            "SMTP": {
                "class": "memorydelaysmtphandler.memorydelaysmtphandler.MemoryDelaySmtpHandler",
                "mailhost": ["smtp.gmail.com", 587],
                "fromaddr": "noreply@yourdomain.com",
                "toaddrs" : ["youraddress@gmail.com"],
                "subject" : "OpenCanary Alert",
                "credentials" : ["youraddress", "abcdefghijklmnop"],
                "secure" : [],
                "capacity" : 128,
                "delay" : 60                
             }
         }
     }
 }

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc