Skip to content

An updated mail sending module in python, it takes into account gmail's latest policy. You can send your next email in 30 seconds using my defaukt properties.

License

Notifications You must be signed in to change notification settings

Firebreather-heart/firebmail

Repository files navigation

firebmail

firebmail is a simple Python module for sending emails using the SMTP protocol. It allows you to send plain text or HTML emails and optionally attach files. The module is designed to work with Gmail by default but can be configured for other SMTP servers as well.

Installation

To use firebmail, you can install it via pip:

pip install firebmail

Usage

import os
from firebmail import sendmail


# Example usage
sender = "[email protected]"
password = "your_app_password"
payload = "Hello, this is a test email!"
recipient = "[email protected]"
subject = "Test Email"

sendmail(payload, recipient, sender,password, subject)

Function Parameters

The sendmail function has the following parameters:

payload: The string containing the message, either in plain text or HTML format. recipient: The email address of the recipient. sender: Your email address password: Your app password subject: The email subject (default is "Message from firemail"). type_: The type of payload, either 'plain' or 'html' (default is 'plain'). filepath: The path of the email attachment, default is None. client: The name of the client (default is 'smtp.gmail.com'). Attempts to use unrelated mail services may result in failure

Example with attachment

import os
from firebmail.firebmail import sendmail



# Example usage with attachment
sender = "[email protected]"
password = "your_app_password"
payload = "Hello, this email includes an attachment."
recipient = "[email protected]"
subject = "Email with Attachment"
filepath = "path/to/your/file.pdf"

sendmail(payload, recipient,sender, password, subject, filepath=filepath)

Sending Batch Mail

Using the sendmail function in a loop to send multiple emails can be inefficient, because it authenticates each time; instead use the BatchMail class to send multiple emails efficiently.

from firebmail import BatchMail

sender = "[email protected]"
password = "my app password"

payload = "Hello, this is a test email!"
subject = "Test Email"

batch = BatchMail(sender = sender, password = password, subject=subject, payload=payload)
batch.send_batch(['[email protected]', '[email protected]', '[email protected]'])

Note

Make sure to use this module responsibly and adhere to the email sending policies of your email service provider. Additionally, consider using application-specific passwords for enhanced security.

For Gmail users, you can generate an app password by following the instructions here.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributing

Pull requests are welcome. For major changes, please open an issdriveue first to discuss what you would like to change.

Issues

If you encounter any issues, feel free to open an issue in the repository.

About

An updated mail sending module in python, it takes into account gmail's latest policy. You can send your next email in 30 seconds using my defaukt properties.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages