https://github.com/datumbrain/django-rest-emailapi
https://github.com/datumbrain/django-rest-emailapi
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/datumbrain/django-rest-emailapi
- Owner: datumbrain
- Created: 2023-03-02T06:07:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-02T10:24:42.000Z (over 3 years ago)
- Last Synced: 2025-01-18T00:29:00.257Z (over 1 year ago)
- Language: Python
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Django REST framework Email API
This is a Django-based RESTful API for sending emails. It allows you to send emails by making POST requests to the API with the required data in JSON format.
## Prerequisites
* Docker
* Docker Compose
## Installation
1. Clone the repository:
```bash
git clone git@github.com:datumbrain/django-rest-emailapi.git
```
2. Navigate to the project directory:
```bash
cd django-rest-emailapi
```
Open the project in your code editior.
3. Create a virtual environment in the project root directory and activate it.
```bash
python3 -m venv env
source env/bin/activate
```
5. In the project navigate to settings.py file (project path/emailapi/settings.py)and set the values of `SECRET_KEY`, `EMAIL_HOST_USER` and `EMAIL_HOST_PASSWORD` with your own email credentials.
6. Run the Docker containers:
```bash
docker-compose up -d
```
7. Visit http://0.0.0.0:8000/email in your web browser to access the email API.
## API Endpoints
### POST /email/
This endpoint sends an email with the provided data in JSON format. Required fields: to_email, subject, body, from_email.
## Response
On success, the API returns a 200 OK response with the message "Email sent".
On failure, the API returns a 400 Bad Request response with the error message or a 500 with a message "Email sending failed".