Skip to main content

A lightweight Python library for sending emails with minimal setup

Project description

EasyMail

EasyMail is a lightweight Python library for sending emails with minimal setup. It automatically detects your email provider's SMTP settings so you don't have to configure them manually.


Installation

pip install EasyMail

Dependencies:

  • requests — fetches provider SMTP config automatically
  • email-validator — validates email addresses before sending

Quick Start

from smtpmailmime import EasyMail

email = EasyMail()
email.username = "you@gmail.com"
email.password = "your_password"

email.sent = {
    "To": "recipient@example.com",
    "Subject": "Hello!",
    "Body": "This is the email body."
}

That's it. EasyMail will auto-detect the SMTP server for your provider and send the email.


Email Fields

Field Required Description
To Yes Recipient email address(es). Separate multiple with commas.
Cc No Carbon copy recipient(s). Separate multiple with commas.
Bcc No Blind carbon copy recipient(s). Not visible to other recipients.
Subject No Email subject line. Defaults to "No subject" if omitted.
Body No Email body text.
Body_type No Set to "html" to send an HTML email. Defaults to "plain".
Attachment No File path(s) to attach. Separate multiple paths with commas.

Examples

Sending to multiple recipients

email.sent = {
    "To": "alice@example.com, bob@example.com",
    "Subject": "Team Update",
    "Body": "Here is the latest update."
}

CC and BCC

email.sent = {
    "To": "alice@example.com",
    "Cc": "manager@example.com",
    "Bcc": "archive@example.com",
    "Subject": "Project Report",
    "Body": "Please find the report attached."
}

HTML email

email.sent = {
    "To": "recipient@example.com",
    "Subject": "HTML Email",
    "Body": "<h1>Hello!</h1><p>This is an <b>HTML</b> email.</p>",
    "Body_type": "html"
}

Sending attachments

email.sent = {
    "To": "recipient@example.com",
    "Subject": "Files attached",
    "Body": "See attached files.",
    "Attachment": "report.pdf"
}

Sending multiple attachments

email.sent = {
    "To": "recipient@example.com",
    "Subject": "Multiple Files",
    "Body": "See the attached files.",
    "Attachment": "report.pdf, photo.png, data.csv"
}

Provider Auto-Configuration

EasyMail uses Thunderbird's autoconfig service to look up SMTP settings based on your email domain. This means it works out of the box for most major providers (Gmail, Outlook, Yahoo, iCloud, etc.) without any manual setup.

Manual SMTP Configuration

If your provider is not supported or auto-config fails, you can override the settings manually:

email.username = "you@yourdomain.com"
email.password = "your_password"
email._config = {
    "smtp": {
        "server": "smtp.yourdomain.com",
        "port": "587"
    }
}

email.sent = {
    "To": "recipient@example.com",
    "Subject": "Manual config test",
    "Body": "Sent using manual SMTP config."
}

Common Errors

Error Cause
Missing email address username was not set
Missing email password password was not set
Unsupported email provider Auto-config could not find SMTP settings for your domain
Missing recipient email address To field was not provided
Invalid recipient email address One of the addresses in To, Cc, or Bcc is malformed
Invalid email credentials Wrong username or password (SMTP auth failed)
FileNotFoundError An attachment path does not exist

Notes

  • Emails are sent over SMTP with STARTTLS encryption (port 587).
  • For Gmail, you may need to use an App Password if 2-factor authentication is enabled.
  • BCC recipients are included in delivery but their addresses are not visible to To or Cc recipients.

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

smtpmailmime-0.1.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

smtpmailmime-0.1.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file smtpmailmime-0.1.2.tar.gz.

File metadata

  • Download URL: smtpmailmime-0.1.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for smtpmailmime-0.1.2.tar.gz
Algorithm Hash digest
SHA256 070c18864b6e53350bdf4e00cf2fa83313f9ea65b664ef40140214e2180ed34a
MD5 e7207c4fa33eb3202c3345ec0ddadeb5
BLAKE2b-256 c295f204d13c0d121d1cbac9bad400e60be069b3283935709042013ea453c960

See more details on using hashes here.

File details

Details for the file smtpmailmime-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: smtpmailmime-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for smtpmailmime-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0100654beef07ff20a397c210ed14692c877e33b9e781be8ccab337fb6bf7d9
MD5 c541e0b124bd2c9d24f5ece66ab30934
BLAKE2b-256 4e73ae83fa98ba77e2c45229e61d3a18ea5550751cfc1657d3054f5238ba386f

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