Metadata-Version: 2.1
Name: pymailers
Version: 2.0.0
Summary: The classic email sending library for Python was expanded to include more useful features
Home-page: https://github.com/riodev99/pymailers
Author: riodev99
Author-email: jgeniya1994@gmail.com
Project-URL: Source, https://github.com/riodev99/pymailers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jinja2 >=2.11.3

# PyMailers
The classic email sending library for Python, now with enhanced features like HTML templates and attachment support.

## Installation
To install PyMailers, run the following command:

```bash
pip install pymailers
```

## Features
Send emails with HTML content.
Support for secure SMTP connections using starttls.
Ability to send emails with attachments.
Templating support using Jinja2 for dynamic email bodies.
Optional logging for successful and failed email deliveries.
Requirements
Ensure you have the following Python modules installed:
smtplib
email
os
sys
jinja2 (for templating)
logging (for logging support)

You can install the required modules using pip:

```bash
pip install -r requirements.txt

```

## Usage
PyMailers is simple to use yet powerful. Here's a quick example of sending an email with a plain text body. You can set display to False to suppress logs, or True to print logs after sending the email.

```bash
from pymailers.PyMailer import PyMailer

pymailer = PyMailer({
    'smtp_host': 'smtp.gmail.com',
    'smtp_port': 587,
    'email': 'your-email@gmail.com',
    'password': 'your-password',
    'to': 'recipient-email@gmail.com',
    'subject': 'Hello World',
    'body': '<p>Hi, I'm Rio</p>',
    'display': True
})

pymailer.send()
```

To send an email with attachments and using an HTML template:

```bash
pymailer = PyMailer({
    'smtp_host': 'smtp.gmail.com',
    'smtp_port': 587,
    'email': 'your-email@gmail.com',
    'password': 'your-password',
    'to': 'recipient-email@gmail.com',
    'subject': 'Greetings',
    'body': '', # Body will be generated by the template
    'display': True,
    'attachments': ['path/to/attachment1.pdf', 'path/to/image.jpg'],
    'template_path': 'path/to/template.html',
    'template_context': {'name': 'Rio'}
})

pymailer.send()
```

Make sure to replace the placeholders with your actual SMTP settings, email credentials, and file paths.

Logging
All operations are logged into pymailer.log. This is helpful for auditing and debugging purposes.


## Donate
- [Saweria](https://saweria.co/rioagungpurnomo)
- [Trakteer](https://trakteer.id/rioagungpurnomo)
- [PayPal](https://www.paypal.me/rioagungpurnomoo)
