Skip to content

Sending Email using FastAPI Mail (Background Task and Async) and Jinja2 Template

Notifications You must be signed in to change notification settings

maxwellwachira/FastAPI-Mail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sending Email using FastAPI Mail

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

Description

FastAPI-Mail is a simple lightweight mail system, sending emails and attachments(individual && bulk). This project shows how to send emails both asynchronously and using Background Tasks. The email body parameters are provided as the request body. These parameters are then used by the HTML email template
The image below shows the request body(Right side) and the email received by the recepient (Left side)


Table of contents

Prerequisites

Directory-Structure

FastAPI-Mail
├── app			             # contains app files 
|   ├── models.py  
|	└── send_mail.py  
├── templates
|   ├── email
|   |   └── email.html 
|	└── landing_page.html 
├── .env    
├── main.py                  # Application entry point
├── requirements.txt		 # project dependencies
└── README.md

Setting-up-Local-Environment

clone the repository and navigate to the project directory

git clone https://github.com/maxwellwachira/FastAPI-Mail.git
cd FastAPI-Mail/

Create a python virtual environment and activate it

python3 -m venv venv
source venv/bin/activate

Install Project dependencies

pip install -r requirements.txt

create a file and name it as .env. Copy contents of .env.example to .env

Acknowledgement

Special thanks to sabuhish the author of fastapi-mail module.
Special thanks to Sebastián Ramírez aka @tiangolo the creator of FastAPI

License

license

About

Sending Email using FastAPI Mail (Background Task and Async) and Jinja2 Template

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published