skillfed

yagmail

Yet Another GMAIL client

yagmail v0.16.0 382.1K downloads/30d#7,092 on PyPI2,731
Permissive license MIT Active released

What it is and what it does

Yagmail is a Python SMTP client designed to make sending emails as straightforward as possible. It wraps the standard library's SMTP functionality and adds convenience features like automatic content-type detection (plain text, HTML, images, attachments), support for multiple recipients with aliases, and both synchronous and asynchronous sending via asyncio. The package handles the common friction points of email composition—figuring out MIME types, encoding attachments, building multipart messages—so you can focus on the message content.

It works with Gmail (using Application-Specific Passwords or OAuth2) and any SMTP server. The API is minimal: instantiate a Client with credentials, then call send() with recipients, subject, and contents. Contents can be a mix of strings, file paths, and HTML snippets, and the library intelligently detects what each item is. An asynchronous version is built in for non-blocking email operations.

Use it for:

  • Sending transactional emails (notifications, confirmations) from a Python application without managing SMTP boilerplate.
  • Automating bulk email campaigns with attachments and HTML formatting from a script or scheduled task.
  • Building a command-line email tool that accepts recipients, subject, and file attachments as arguments.
  • Integrating email alerts into monitoring or logging systems with minimal code overhead.
  • Sending emails asynchronously in a web application to avoid blocking request handlers.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Simplifies sending emails via Gmail or any SMTP server, with built-in support for attachments, HTML content, and asynchronous sending.

Yes. Yagmail is actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. It is well-suited for developers who need straightforward email sending without the complexity of raw SMTP or heavier frameworks. Use it when you want to send emails quickly from Python without boilerplate—particularly for Gmail or simple SMTP scenarios. The built-in async support and intelligent content handling make it practical for both scripts and applications.

Install

yagmail on PyPI

pip

pip install yagmail

uv

uv add yagmail

poetry

poetry add yagmail

Installing yagmail

Before you install

Low install friction with a single runtime dependency (premailer). Active maintenance with a recent release (80 days ago) and 2731 repository stars indicate ongoing support and community use.

License in practice

MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install yagmail

import yagmail
yag = yagmail.Client('mygmailusername', 'mygmailpassword')
yag.send('to@someone.com', 'subject', 'body text')

Gmail requires an Application-Specific Password (regular account passwords no longer work over SMTP); alternatively, OAuth2 authentication can be used.

Verify before relying

  • Whether premailer dependency is required for all use cases or only for HTML email rendering.
  • Current state of OAuth2 token refresh behavior and whether the 7-day expiry limitation still applies.
  • Performance characteristics when sending bulk emails or handling large attachments.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — premailer
Maintenance actively maintained — 80 days since the last release
Last repo commit
First released
Downloads 382,123/month — #7,092 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: yagmail-0.16.0-py3-none-any.whl

Keywords: email, mime, automatic, html, attachment

Environment :: ConsoleIntended Audience :: Customer ServiceIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: MicrosoftOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Communications :: EmailTopic :: Communications :: Email :: Email Clients (MUA)Topic :: Software DevelopmentTopic :: Software Development :: Build ToolsTopic :: Software Development :: DebuggersTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Software DistributionTopic :: System :: Systems AdministrationTopic :: Utilities

Tags

send emails with gmailpython smtp clientemail attachments automationasync email sendinggmail api alternativehtml email pythonbatch email sender
email-automationsmtp-clientasyncio-ready

More Software Development packages