Introduction
"mail-a-tron" is an open-source Python library designed for automating email sending. This library leverages the Gmail API for sending emails and offers a wide array of functionalities, including:
- Sending plain text emails.
- Sending emails with attachments.
- Scheduling email delivery.
- Sending bulk emails.
Developed by Francesco D'Alessio, the project was first introduced on October 22, 2022.
Key Features
The primary features of this project encompass:
- Gmail API Integration: "mail-a-tron" seamlessly integrates with the Gmail API, ensuring reliable email delivery.
- Versatile Functionality: The library provides extensive functionality, making it suitable for various email automation scenarios.
- User-Friendly: Developers will appreciate the ease with which "mail-a-tron" can be incorporated into Python applications.
Usage Instructions
To utilize "mail-a-tron" in your Python projects, follow these simple steps:
- Install the "mail-a-tron" library in your Python project.
- Create a MailATron object.
- Use the
send()
method to send emails.
For comprehensive API documentation, visit the project's GitHub page.
As of October 16, 2023, the project's GitHub repository has garnered 1k stars and 200 forks.
Highlights
Here are the key highlights of "mail-a-tron":
- User-Friendly: "mail-a-tron" prioritizes user-friendliness, ensuring that developers of all skill levels can efficiently automate email sending.
- Versatile Functionality: The library offers a broad range of features, enabling developers to address diverse email automation requirements.
- Ideal for Python Applications: "mail-a-tron" is tailored for Python applications, making it a valuable tool for automating email communication within Python projects.
Usage Example
Below is a Python code example showcasing the usage of "mail-a-tron":
import mail_a_tron
# Create a MailATron object
mail_atron = mail_a_tron.MailATron(
email="your_email@example.com",
password="your_password",
)
# Send a plain text email
mail_atron.send(
to="recipient@example.com",
subject="Hello, world!",
message="This is a test email.",
)
# Send an email with an attachment
with open("file.txt", "rb") as f:
mail_atron.send(
to="recipient@example.com",
subject="Attachment Email",
message="This is an email with an attachment.",
attachment=f,
)
# Schedule an email
mail_atron.send(
to="recipient@example.com",
subject="Scheduled Email",
message="This is a scheduled email.",
schedule="2023-10-22T12:00:00",
)
# Send bulk emails
recipients = ["recipient1@example.com", "recipient2@example.com"]
messages = [
("Hello, world!", "This is a test email."),
("Attachment Email", "This is an email with an attachment."),
]
mail_atron.send_batch(recipients, messages)
This code initializes a MailATron object and uses the send()
method to send emails.