Email Service
Simple Django REST API for Email Service to customers using SendGrid and MailGun email service providers.
Steps to build
- Source a virtual environment
- Change directory to repo folder.
Install dependencies:
pip3 install -r requirements.txt
- Migrate:
python3 manage.py makemigrations
python3 manage.py migrate
Run
Run server:
python3 manage.py runserver
API Endpoint
- For development server:
http://127.0.0.1:8000/API/
- For hosted server:
https://eserviceapp.herokuapp.com/API/
Change email address to your personal in API/settings.py as a value for EMAIL_ADDRESS
Register on SendGrid and MailGun to obtain a credentials and an API Key through SMTP method.
Add the keys in a file .env
Testing
python3 manage.py test
Functionalities
- GET /API
Returns a list of all email requests. - POST /API
Form data = {
'email_address': 'to@example.com',
'mail_subject':'subject',
'mail_body':'message'
}
Design
Assumptions
- Customers using this service can input an email address, subject, message and in return expect an email from the service.
- Database attachment for saving requests from customers.
- Usage of Factory pattern assuming providers might be updated/added by making changes in the Providers / ProviderFactory.