Simple sending of smtp emails using env variables
Project description
envsmtp
Simple sending of smtp emails using environment variables
Install
pip install --upgrade envsmtp
Environment Variables
You must set SMTP_USER
and SMTP_PASS
in your environment with your user and password!
See additional optional settings in example.env
Usage
This package will by default use STARTTLS settings for smtp.gmail.com
on port 587. If you wish to change these settings, you can set your own environment variables for SMTP_HOST
and SMTP_PORT
Once installed, here's a simple example of how to use this package:
from envsmtp import EmailMessage
msg = EmailMessage(
sender="sender@example.com",
receipients="receipient@example.com",
subject="envsmtp test",
body="This is just a test message",
)
msg.smtp_send()
To send with attachments:
from envsmtp import EmailMessage, EmailAttachment
attachments = [
EmailAttachment(content='/path/to/file.txt'),
EmailAttachment(content=b'randombytes', filename='bytes_test.txt'),
EmailAttachment(content='/path/to/another.txt', filename='this_name_is_different_.txt')
]
msg = EmailMessage(
sender="sender@example.com",
receipients="receipient@example.com",
subject="envsmtp test",
body="This is just a test message",
attachments=attachments,
)
msg.smtp_send()
Requirements
Tested with & designed for python 3.10, see requirements.txt for additional dependencies
Contributing
For bugs / feature requests please submit issues
If you would like to contribute to this project, you are welcome to submit a pull request
Warranty / Liability / Official support
This project is being developed independently, we provide the package "as-is" without any implied warranty or liability, usage is your own responsibility
Additional info
Just because I like badges
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file envsmtp-0.0.2.tar.gz
.
File metadata
- Download URL: envsmtp-0.0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ef12f725b66679e725a005f15cc92ae7ec80fa385693cb7bb4762bc55e68bf7 |
|
MD5 | 2ef3105fdfd405a82dbaf8cfd114cee3 |
|
BLAKE2b-256 | b4c294d578010a3130c6e17ebd4fbe1bca0fcf2d3c49a933b3106c9fe76b27d4 |
File details
Details for the file envsmtp-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: envsmtp-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcc6222218771b6aaed83683056f145d2c13877211e13384d1c868e46d02825f |
|
MD5 | 0133519a896b73ed4dbc5ecfea166412 |
|
BLAKE2b-256 | 7041ac8454b9df8dcf5428c5a5f5ebd3b15a36dbc9b9faeee1ab1255df08ce04 |