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.3.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.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easysmtp-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 3d2d717780a852b89abd34720a48466d9d05f0548f31f40c4f4f1ccbeb82d5ea
MD5 e93a6b6cb3b4a55605b3d4845230ce99
BLAKE2b-256 2468fcb96fe45e4ad8046482079ec642f450945f0ec8b596cff2923f0777bd17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easysmtp-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d983279eb1c0909afa623f90c31f13364e3b9df7512c8440a78652698d4749c
MD5 974f6f62f1230565ed53dbd62d1c8714
BLAKE2b-256 60cceceeaf05af05988748148bb1f891e52f1c042a63829916a42b8210744623

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