Fork of tinysmtp with bug fixes and Python 3 compatibility
Project description
This is a fork of Rick Harris’s tinysmtp package with a few fixes and Python 3 compatibility.
Example:
with Mail().connect() as mail:
msg = Message(
'alice@example.com', 'Subject', ['bob@example.com'], body='body')
mail.send(msg)
Connections may be configured from a URL specified in an environment variable:
export MAILSEND_URL="smtp+tls://user:password@server.example.org/"
Or as individual variables:
export MAILSEND_HOSTNAME=server.example.org export MAILSEND_PORT=25
Or in code:
mail = Mail('smtp://server.example.org/')
mail2 = Mail('server.example.org',
port=25,
ssl=True,
username='x',
password='x')
Call mail.send to send a message:
mail = Mail('smtp://server.example.org/')
mail.send(sender='alice@example.com',
recipients=['bob@example.com', 'charlie@example.com'],
body='Hello everyone!',
html='<p>Hello everyone!</p>',
subject='Hello')
Or use the message class to construct messages piecemeal:
msg = Message('alice@example.com', 'Hello!')
msg.body = 'Hello'
msg.recipients = ['bob@example.com']
msg.cc = ['charlie@example.org']
msg.bcc = ['dina@example.org']
mail = Mail('smtp://server.example.org/')
mail.send(msg)
To send multiple messages in a single connection, use Mail.connect:
with mail.connect() as conn:
conn.send(msg1)
conn.send(msg2)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailsend-2.0.0.tar.gz.
File metadata
- Download URL: mailsend-2.0.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f84f6e97b3305b6eca72c88d52a95cf6cf7d065a67e0e838b45891063c40adf
|
|
| MD5 |
735fe44b9ae47f68ad8a3a07f576d8a3
|
|
| BLAKE2b-256 |
8856bab2e6fb97a89415349a42f15cffef990e66f58627b3432b5c3a031554bd
|
File details
Details for the file mailsend-2.0.0-py3-none-any.whl.
File metadata
- Download URL: mailsend-2.0.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ed099382d0242674c22a12b5177b2c8a4a2ceb2b7693362e9bf8a83e118fd1
|
|
| MD5 |
acf62c088005df1c978bd8de02bd6767
|
|
| BLAKE2b-256 |
4d6e3d7c32f9a9e922160fa4bc0348f49b8ae2a461a643842306ff8bfff0d972
|