Skip to main content

Porting Django's email implementation to your FastAPI applications.

Project description

📬 Fastapi-Mailman

🔥 Porting Django's email implementation to your FastAPI applications.

PyPI PyPI - Downloads dev workflow GitHub commits since latest release (by SemVer) PyPI - License

Fastapi-Mailman is a Fastapi extension providing simple email sending capabilities. It's actually a hard fork of waynerv's flask-mailman module. I have tried to implement the same features for the Fastapi too.

It was meant to replace the basic Fastapi-Mail with a better warranty and more features.

⛲ Key Features:

  1. Easy to use.
  2. Backend based email sender.
  3. Customisable backend class.
  4. Proper testcases.
  5. Proper documentation.

🔗 Important Links:

Github Repo
PYPI
Documentation

💯 Usage

Fastapi-Mailman ported Django's email implementation to your Fastapi applications, which may be the best mail sending implementation that's available for python.

The way of using this extension is almost the same as Django.

Documentation: https://marktennyson.github.io/fastapi-mailman.

🪜 Basic Example

from fastapi import FastAPI
import uvicorn as uv
from fastapi_mailman import Mail, EmailMessage
from fastapi_mailman.config import ConnectionConfig

app = FastAPI(debug=True)

config = config = ConnectionConfig(
    MAIL_USERNAME = 'example@domain.com',
    MAIL_PASSWORD = "7655tgrf443%$",
    MAIL_BACKEND =  'smtp',
    MAIL_SERVER =  'smtp.gmail.com',
    MAIL_PORT = 587,
    MAIL_USE_TLS = True,
    MAIL_USE_SSL = False,
    MAIL_DEFAULT_SENDER = 'example@domain.com',
    )
mail = Mail(config)

@app.get("/send-base")
async def send_base():
    msg = EmailMessage('this is subject', 'this is message', to=['aniketsarkar@yahoo.com'])
    await msg.send()
    return {"Hello": "World"}

@app.get("/send-mail")
async def check_send_mail():
    await mail.send_mail("this is subject", "this is message", None, ["aniketsarkar@yahoo.com"])
    return {"Hello": "World"}


if __name__ == "__main__":
    uv.run(app, port=8082, debug=True)

🚇 Development

🧑‍💻 Contribution procedure.

  1. Create a new issue on github.
  2. Fork and clone this repository.
  3. Make some changes as required.
  4. Write unit test to showcase its functionality.
  5. Submit a pull request under the master branch.

🖨️ Run this project on your local machine.

To run this project on your local machine please click here

❤️ Contributors

Credits goes to these peoples:

📝 License

MIT

Copyright (c) 2021 Aniket Sarkar(aniketsarkar@yahoo.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Fastapi-Mailman-0.0.4.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

Fastapi_Mailman-0.0.4-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file Fastapi-Mailman-0.0.4.tar.gz.

File metadata

  • Download URL: Fastapi-Mailman-0.0.4.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for Fastapi-Mailman-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a610d547b38f12c4546719006ffb9c4a41dd4fa5cccb1de72e0ec1782e91cbce
MD5 d912fee8654241b805884f01f70f59f3
BLAKE2b-256 2d4342a7463887dbedd0e7aafca4ed0ecd5fe06df56cab356cb6ee5def4640e8

See more details on using hashes here.

File details

Details for the file Fastapi_Mailman-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: Fastapi_Mailman-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for Fastapi_Mailman-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 04f49af5c0a97f63bb61a53086d97bdecf0ecba6a9aca3e88d5cdb5f6a5b6995
MD5 52ef04a34ade282f1f718ae321121189
BLAKE2b-256 5ac5212db0097d253eeda1f4ed3e5954b7c285578bb2be86f56cf5ec84ea6faa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page