Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplesmtp-0.0.3-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file simplesmtp-0.0.3.tar.gz.

File metadata

  • Download URL: simplesmtp-0.0.3.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7rc1

File hashes

Hashes for simplesmtp-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4c58cbeeb90a0a963426785f815b2d28988f42034f63c454417e2ca1fe2a34be
MD5 26fb2d5e52195900f72d96a0cd0589c5
BLAKE2b-256 4ed1fbefdba905bb60af240ec14ca52d58d7a80549992e32231c45a60bcdcd31

See more details on using hashes here.

File details

Details for the file simplesmtp-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: simplesmtp-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7rc1

File hashes

Hashes for simplesmtp-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 12942fc7aa620b8c3b6e236664b095b62ef13fde0f5dda082c3e282a5b78eb89
MD5 d08ebb09ce2e5a90175d2d64a8678d37
BLAKE2b-256 cd931b70f49c79b98fa7ace74dceaf714f708daa137fa54226d1342337bf9418

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page