--- id: yagmail version: "0.16.0" license: MIT license_treatment: permissive maintenance: active --- # yagmail — Yet Another GMAIL client License: permissive · Maintenance: active · Downloads: 382.1K/mo ## 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 above — 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 pip install yagmail uv add yagmail 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_current - Install friction: low - Maintenance: active - Downloads: 382.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags send emails with gmail, python smtp client, email attachments automation, async email sending, gmail api alternative, html email python, batch email sender, email-automation, smtp-client, asyncio-ready [View on SkillFed](https://skillfed.io/packages/yagmail) · [View on PyPI](https://pypi.org/project/yagmail/)