Skip to main content

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)

Release files for mailsend 2.0.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 mailsend 2.0.0
File Size Uploaded
mailsend-2.0.0.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mailsend 2.0.0
File Interpreter ABI Platform
mailsend-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / mailsend-2.0.0.tar.gz

Download URL mailsend-2.0.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5f84f6e97b3305b6eca72c88d52a95cf6cf7d065a67e0e838b45891063c40adf
BLAKE2b-256 checksum
How to use checksums
8856bab2e6fb97a89415349a42f15cffef990e66f58627b3432b5c3a031554bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / mailsend-2.0.0-py3-none-any.whl

Download URL mailsend-2.0.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0ed099382d0242674c22a12b5177b2c8a4a2ceb2b7693362e9bf8a83e118fd1
BLAKE2b-256 checksum
How to use checksums
4d6e3d7c32f9a9e922160fa4bc0348f49b8ae2a461a643842306ff8bfff0d972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

0.0

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