Skip to main content

A simple SMTP client.

Project description

EasySMTP: A simple SMTP client

EasySMTP is a simple and lightweight SMTP client written in pure Python.It is distributed as a single file module and has no dependencies other than the Python Standard Library.

Features

  • Send plain text email
  • Send HTML email
  • Send email with attachments
  • Guess MIME type of attachments
  • Send email with embedded images
  • Built-in well-known SMTP servers configuration

Installation

Install the latest stable release with pip install easysmtp or download easysmtp.py into your project.

Usage

To use it, you need to enable SMTP for your email. You can find instructions on how to enable SMTP for your email service provider on the internet.

import easysmtp


from_addr = 'user@gmail.com'
smtp_username = from_addr # SMTP login username. It's usually your email address.
smtp_password = 'password'

smtp = easysmtp.EasySMTP()
smtp.config(from_addr,
            username=smtp_username, 
            password=smtp_password,)

to_addr = 'to@gmail.com'
subject = 'Hello'

# Send a plain text email
smtp.send_mail(from_addr, to_addr, subject, body='Hello world!')

# Send an HTML email
smtp.send_mail(from_addr, to_addr, subject, html_body='<h1>Hello world!</h1>')

# Send an email with attachments
smtp.send_mail(from_addr, to_addr, subject, body='Hello world!', attachments=['README.md'])

# Send an email with embedded images
html_body = '<p>Hello world!</p><img src="cid:test.png">'
smtp.send_mail(from_addr, to_addr, subject, html_body=html_body, attachments=['test.png'])

# or more control with attachment cid
attachments = [Attachment("tests/测试.png", cid="test.png")]
smtp.send_mail(from_addr, to_addr, subject, html_body=html_body, attachments=attachments)

Built-in SMTP servers

  • 126.com
  • 163.com
  • gmail.com
  • outlook.com
  • qq.com
  • sina.com
  • yahoo.com

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

easysmtp-0.1.5.tar.gz (54.6 kB view details)

Uploaded Source

Built Distribution

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

easysmtp-0.1.5-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file easysmtp-0.1.5.tar.gz.

File metadata

  • Download URL: easysmtp-0.1.5.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.2 CPython/3.11.2 Linux/6.1.0-25-amd64

File hashes

Hashes for easysmtp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6108d07dae8b24b192fe7762a54c7c67503139dc9faafcac7b6640a096820fcd
MD5 77184c077bac703b42b56669b0f45629
BLAKE2b-256 cd001321f31c6188185a83cdaeae6f2d0917cb698083a4f666c3e4650732e325

See more details on using hashes here.

File details

Details for the file easysmtp-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: easysmtp-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.2 CPython/3.11.2 Linux/6.1.0-25-amd64

File hashes

Hashes for easysmtp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 58aaef3cad7d14f487541370ee1d1ef80ea0eab4d89fb0bc1dc56e63d9d8b2b6
MD5 583eeb853acefef52ce1db05f7b5d13a
BLAKE2b-256 a64dcbd24df3f400e2331a8ecf80c31917b16fe66ed97c9b3e9763d294370a7a

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