A very simple class to send e-mails using the SMTP Python Lib
Project description
A very simple class to send e-mails using the Python SMTP standard lib.
Usage
from simplesmtp import SimpleSMTP
mail = SimpleSMTP(
host='mail.host',
username='user@mail.host',
passw='password',
from_email='You <youremail@mail.host>'
)
mail.send(to_email='email@example.com', subject='Hello', email_message='World')
# Changing default from_email
mail.send(
from_email='Another From <email@example.com>',
to_email='email@example.com',
subject='Hello',
email_message='World'
)
# Sending to more than one recipient
mail.send(
to_email='email1@example.com, email2@example.com',
subject='Hello',
email_message='World'
)
# Attachments
mail.send(
to_email='email1@example.com, email2@example.com',
subject='Hello',
email_message='World',
attachments=[
{
'file': '/path/to/real/file',
'filename': 'the name that you want'
}
]
)
Using SSL
from simplesmtp import SimpleSMTP
mail = SimpleSMTP(
host='mail.host',
username='user@mail.host',
passw='password',
from_email='You <youremail@mail.host>',
port=465,
use_ssl=True
)
mail.send(to_email='email@example.com', subject='Hello', email_message='World')
HTML messages
from simplesmtp import SimpleSMTP
mail = SimpleSMTP(
host='mail.host',
username='user@mail.host',
passw='password',
from_email='You <youremail@mail.host>'
)
mail.send(
to_email='email@example.com',
subject='Hello',
email_message='<html> HTML source with optional embedded images ... </html>',
msg_type='html'
)
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
simplesmtp-0.0.3.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for simplesmtp-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12942fc7aa620b8c3b6e236664b095b62ef13fde0f5dda082c3e282a5b78eb89 |
|
MD5 | d08ebb09ce2e5a90175d2d64a8678d37 |
|
BLAKE2b-256 | cd931b70f49c79b98fa7ace74dceaf714f708daa137fa54226d1342337bf9418 |