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.
This project is under development, not recommended for use in production directly.
- Send emails via HTTP
POST
request - Configure
HTML
andRAW
body seperately - Blacklist & Whitelist email addresses
- Whitelist IP for API calls
- Multiple email support
- Email verification via OTP
- SMS Support using AWS SNS
If you have any other suggestions, feel free to open a Issue or Pull Request
Client: Swagger, Bootstrap
Server: Python3, FastAPI, smtplib
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 |
import requests
reqUrl = "http://<host>:<port>/email/send"
headersList = {
"Content-Type": "application/json"
}
payload = json.dumps({
"email":"viperadnan@gmail.com",
"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.
This 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
apt install git python3 python3-pip
- Cloning Project
git clone https://github.com/viperadnan-git/emailer-py
cd emailer-py
- Installing dependencies via
pip
pip install -r requirements.txt
All configuration are inside a single file config.yml
server:
allowed_hosts: ["127.0.0.1", "103.201.127.144", "*"]
smtp:
username: viperadnan@email.com
password: TheStr@ngPassword
host: smtp.mail.yahoo.com
port: 587
options:
whitelist: ["*@gmail.com"]
blacklist: ["*-*@gmail.com"]
To deploy this project via uvicorn (ASGI server implementation) run
uvicorn main.app:app
By default this will listen to localhost
and port 8000
.
To listen to desired host nad port pass the --host <host>
and --port <port>
flags accordingly.
If you want to listen on all host and HTTP
request (with port 80)
uvicorn main.app:app --host 0.0.0.0 --port 80
Contributions are always welcome!
To discuss about the improvement/contribution on this project join group chat.
Made with ♥ and Licensed under GNU General Public License v3.0