https://github.com/botsarefuture/email_delivery_client
Client for Flask email delivery service: https://github.com/botsarefuture/email_delivery_service
https://github.com/botsarefuture/email_delivery_client
Last synced: 3 months ago
JSON representation
Client for Flask email delivery service: https://github.com/botsarefuture/email_delivery_service
- Host: GitHub
- URL: https://github.com/botsarefuture/email_delivery_client
- Owner: botsarefuture
- Created: 2024-04-16T07:06:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-06T18:54:02.000Z (almost 2 years ago)
- Last Synced: 2024-09-07T18:44:44.918Z (almost 2 years ago)
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Email Client
This Python client interacts with the provided Flask API for sending emails. It allows you to send emails using the specified SMTP servers.
Github repository of the server: [github.com/botsarefuture/email_delivery_service](https://github.com/botsarefuture/email_delivery_service.git)
## Installation
1. Clone this repository:
```bash
git clone https://github.com/botsarefuture/email_delivery_client.git
```
2. Navigate to the directory:
```bash
cd email-client
```
3. Install the required dependencies:
```bash
pip install requests
```
## Usage
1. Import the `EmailClient` class from `email_client.py`.
2. Create an instance of `EmailClient` by providing the base URL of the Flask API.
3. Use the `send_email` method to send emails with the required parameters.
Example usage:
```python
from email_client import EmailClient
client = EmailClient("http://localhost:5000")
email_from = "sender@example.com"
email_to = "recipient@example.com"
subject = "Test Email"
text = "This is a test email."
html = "
This is a test email.
"
email = "sender@example.com"
password = "password"
smtp_index = 0
response = client.send_email(email_from, email_to, subject, text=text, html=html, email=email, password=password, smtp_index=smtp_index)
print(response)
```
## API Specification
The client interacts with the following API endpoint:
- `POST /send_email`: Sends an email with the provided parameters.
Required Parameters:
- `email_from`: Sender's email address.
- `email_to`: Recipient's email address.
- `subject`: Email subject.
Optional Parameters:
- `text`: Plain text content of the email.
- `html`: HTML content of the email.
- `email`: Sender's email address (if not provided in session).
- `password`: Sender's email password (if not provided in session).
- `smtp_index`: Index of the SMTP server to use (if not using default configuration).