Skip to main content

Email To

https://img.shields.io/pypi/v/email_to.svg https://img.shields.io/travis/abkfenris/email_to.svg Documentation Status Updates

Simplyify sending HTML emails

Judgement rendered by:

Codacy Code Health Code Climate scrutinizer

Features

The built in Python modules for sending email are powerful, but require a lot of boilerplate to write an HTML formatted email.

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib

message = MIMEMultipart('alternative')
message['Subject'] = 'Test'
message['From'] = 'user@gmail.com'
message['To'] = 'someone@else.com'

message.attach(MIMEText('# A Heading\nSomething else in the body', 'plain')
message.attach(MIMEText('<h1 style="color: blue">A Heading</a><p>Something else in the body</p>', 'html')

server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('user@gmail.com', 'password')
server.sendmail('user@gmail.com', 'someone@else.com', message.as_string())
server.quit()

With email_to sending a simple email becomes much more succint.

import email_to

server = email_to.EmailServer('smtp.gmail.com', 587, 'user@gmail.com', 'password')
server.quick_email('someone@else.com', 'Test',
                   ['# A Heading', 'Something else in the body'],
                   style='h1 {color: blue}')

email_to also supports building a message up, line by line. This is especially useful for monitoring scripts where there may be several different conditions of interest.

import email_to

server = email_to.EmailServer('smtp.gmail.com', 587, 'user@gmail.com', 'password')

message = server.message()
message.add('# Oh boy, something went wrong!')
message.add('- The server had a hiccup')
message.add('- The power went out')
message.add('- Blame it on a rogue backhoe')
message.style = 'h1 { color: red}'

message.send('someone@else.com', 'Things did not occur as expected')

Additionally if the server details are not known at the beginning of the message, that can be handled easily too.

import email_to

message = email_to.Message('# Every thing is ok')
message.add('Everything has been running fine for days.')
message.add('Probably time to build something new and break everything')
message.style = 'h1 { color: green }'

server = email_to.EmailServer('smtp.gmail.com', 587, 'user@gmail.com', 'password')
server.send_message(message, 'someone@else.com', 'Things are awesome')

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2017-09-27)

  • First release on PyPI.

Metadata

Release files for email-to 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for email-to 0.1.0
File Size Uploaded Provenance Actions
email_to-0.1.0.tar.gz 14.7 kB Without provenance Details for email_to-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for email-to 0.1.0
File Interpreter ABI Platform Actions
email_to-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for email_to-0.1.0-py2.py3-none-any.whl

Total release size: 21.8 kB

Release files / email_to-0.1.0.tar.gz

Download URL email_to-0.1.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
611b47c23e9be1ed51b124a4e350d565607410f763daa6c727d1914083321c2b
BLAKE2b-256 checksum
How to use checksums
b6371df96f9687991f7c61830d61395029615198106ab10f1863df03c96b83ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / email_to-0.1.0-py2.py3-none-any.whl

Download URL email_to-0.1.0-py2.py3-none-any.whl
Size 7.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4cf6bf04fd52f89b1225322ee39fcda917215fb3f1642dee23da76ca171f8840
BLAKE2b-256 checksum
How to use checksums
56333f3a09446b8f8967f98e6df29cdda65d3cc5e40a0f0b6dedf3fd076a60c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for email-to 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page