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

py-emails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

py-emails

Simple wrapper around email and smtplib standard libraries for composing and sending email messages in an intuitive, simple interface.

  • 1.2.1
  • PyPI
  • Socket score

Maintainers
1

py-emails

Build Status Coverage Status

Simple wrapper around email and smtplib for composing and sending email messages in an intuitive, simple interface. Pure python, no dependencies outside of the standard library

Installation and use

Install with pip or your favorite package manager: pip install py-emails

Emails can be created declaratively:

from emails import Email

smtp_config = {
    'sender': 'you@example.com',
    'host': 'smtp.example.com'
}

first_attachment = {
    'filename': 'example.png', 
    'content': open('example.png', 'rb').read()
}
other_attachment = {
    'filename': 'example.csv', 
    'content': open('example.csv', 'rb').read()
}
my_email = Email( 
    smtp_config, 
    subject='How are you?',
    body='Long time no see, we should get together!',
    attachments=[first_attachment, other_attachment]
)

Or using a template dictionary:

from emails import from_template

smtp_config = {
    'sender': 'you@example.com',
    'host': 'smtp.example.com',
    'port': 587,
    'password': '<secret password>'
}
template = {
    'smtp_config': smtp_config,
    'subject': 'How are you?',
    'body': 'Long time no see, we should get together!'
}
my_email = from_template(template)

Once you have the email object, sending it is as simple as specifying one or more recipients:

import emails

smtp_config = {
    'sender': 'you@example.com',
    'host': 'smtp.example.com'
}
my_email = emails.Email(smtp_config)
my_email.send('person1@example.com')
my_email.send(['person2@example.com', 'person3@example.com'])

See examples.py for more in depth use cases

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