Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viperadnan-git/emailer-py
Emailer API built using FastAPI and smtplib
https://github.com/viperadnan-git/emailer-py
Last synced: 3 months ago
JSON representation
Emailer API built using FastAPI and smtplib
- Host: GitHub
- URL: https://github.com/viperadnan-git/emailer-py
- Owner: viperadnan-git
- License: gpl-3.0
- Created: 2022-02-10T06:46:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T16:51:41.000Z (about 2 years ago)
- Last Synced: 2024-06-28T13:35:15.250Z (5 months ago)
- Language: Python
- Size: 20.5 KB
- Stars: 14
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Emailer
An API to integrate in other apps to send emails, OTPs or newsletter. No need to setup your on SMTP server you can use Gmail, AWS, Yahoo, Yandex or any other email services to confiugre this app and send emails programatically.
[![GitHub license](https://img.shields.io/github/license/viperadnan-git/emailer-py?style=for-the-badge)](https://github.com/viperadnan-git/emailer-py/blob/main/LICENSE)
![](https://img.shields.io/badge/Python-3.9-blue?style=for-the-badge)
![](https://img.shields.io/badge/Made%20With-%F0%9F%92%99-red?style=for-the-badge)> This project is under development, not recommended for use in production directly.
## Table of Contents
- [Features](#features)
- [Roadmap](#roadmap)
- [Tech Stack](#tech-stack)
- [Usage/Example](#api-reference)
- [API Reference](#api-reference)
- [Example](#usage-example)
- [Getting Started](#installation)
- [Installation](#installation)
- [Configuration](#configuration)
- [Deployment](#deployment)
- [Contribution](#contributing)
- [License](#license)
## Features- Send emails via HTTP `POST` request
- Configure `HTML` and `RAW` body seperately
- Blacklist & Whitelist email addresses
- Whitelist IP for API calls
## Roadmap- Multiple email support
- Email verification via OTP
- SMS Support using AWS SNSIf you have any other suggestions, feel free to open a Issue or Pull Request
## Tech Stack**Client:** Swagger, Bootstrap
**Server:** Python3, FastAPI, smtplib
## API Reference
#### Sends an Email
```http
POST /email/send
```| Parameter | Type | Description | Required |
| :-------- | :------- | :------------------------- | :------- |
| `email` | `string` | Email of the receipent | True |
| `body` | `string` | Raw body of the email | True |
| `subject` | `string` | Subject of the email | False |
| `sender` | `string` | Email of the sender | False |
| `sender_name` | `string` | Name of the sender | False |
| `html` | `string` | HTML body of the email | False |## Usage Example
```python
import requestsreqUrl = "http://:/email/send"
headersList = {
"Content-Type": "application/json"
}payload = json.dumps({
"email":"[email protected]",
"body": "Hello from emailer-py"
})response = requests.request("POST", reqUrl, data=payload, headers=headersList)
print(response.text)
```- You can use a `for` loop if you have multiple emails as a list.
## InstallationThis project is built with `python-3.9` and `FastApi` so you need to install python and should have atleast one public PORT and IP
- Installing pre-requisites
```bash
apt install git python3 python3-pip
```- Cloning Project
```bash
git clone https://github.com/viperadnan-git/emailer-py
cd emailer-py
```- Installing dependencies via `pip`
```bash
pip install -r requirements.txt
```## Configuration
All configuration are inside a single file [`config.yml`](./config.yml)
```yaml
server:
allowed_hosts: ["127.0.0.1", "103.201.127.144", "*"]smtp:
username: [email protected]
password: TheStr@ngPassword
host: smtp.mail.yahoo.com
port: 587options:
whitelist: ["*@gmail.com"]
blacklist: ["*-*@gmail.com"]
```## Deployment
To deploy this project via uvicorn (ASGI server implementation) run
```bash
uvicorn main.app:app
```By default this will listen to `localhost` and port `8000`.
To listen to desired host nad port pass the `--host ` and `--port ` flags accordingly.If you want to listen on all host and `HTTP` request (with port 80)
```bash
uvicorn main.app:app --host 0.0.0.0 --port 80
```## Contributing
Contributions are always welcome!
To discuss about the improvement/contribution on this project join [group chat](https://t.me/vipercommunity).
## License
Made with ♥ and Licensed under [GNU General Public License v3.0](./LICENSE)