fastapi-mail


Namefastapi-mail JSON
Version 1.4.1 PyPI version JSON
download
home_pagehttps://github.com/sabuhish/fastapi-mail
SummarySimple lightweight mail library for FastApi
upload_time2023-07-18 18:53:20
maintainer
docs_urlNone
authorSabuhi Shukurov
requires_python>=3.8.1,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Fastapi-mail

The fastapi-mail is a simple lightweight mail system, for sending emails and attachments(individual && bulk)


[![MIT licensed](https://img.shields.io/github/license/sabuhish/fastapi-mail)](https://raw.githubusercontent.com/sabuhish/fastapi-mail/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/sabuhish/fastapi-mail.svg)](https://github.com/sabuhish/fastapi-mail/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/sabuhish/fastapi-mail.svg)](https://github.com/sabuhish/fastapi-mail/network)
[![GitHub issues](https://img.shields.io/github/issues-raw/sabuhish/fastapi-mail)](https://github.com/sabuhish/fastapi-mail/issues)
[![Downloads](https://pepy.tech/badge/fastapi-mail)](https://pepy.tech/project/fastapi-mail)


###  🔨  Installation ###


```bash
python3 -m venv .venv

source .venv/bin/activate

pip install fastapi-mail

for aioredis and httpx

pip install 'fastapi-mail[aioredis]'
pip install 'fastapi-mail[httpx]'

```

Alternatively, if you prefer to use `poetry` for package dependencies:

```bash
poetry shell

poetry add fastapi-mail

for aioredis and httpx

poetry add 'fastapi-mail[aioredis]'
poetry add 'fastapi-mail[httpx]'
```

---
**Documentation**: [FastApi-MAIL](https://sabuhish.github.io/fastapi-mail/)
---


The key features are:

-  sending emails either with FastApi or using asyncio module 
-  sending emails using FastApi background task managment
-  sending files either from form-data or files from server
-  Using Jinja2 HTML Templates
-  email utils (utility allows you to check temporary email addresses, you can block any email or domain)
-  email utils has two available classes ```DefaultChecker``` and  ```WhoIsXmlApi```
-  Unittests using FastapiMail

More information on [Getting-Started](https://sabuhish.github.io/fastapi-mail/getting-started/)


### Guide


```python

from typing import List

from fastapi import BackgroundTasks, FastAPI
from fastapi_mail import ConnectionConfig, FastMail, MessageSchema, MessageType
from pydantic import BaseModel, EmailStr
from starlette.responses import JSONResponse



class EmailSchema(BaseModel):
    email: List[EmailStr]


conf = ConnectionConfig(
    MAIL_USERNAME ="username",
    MAIL_PASSWORD = "**********",
    MAIL_FROM = "test@email.com",
    MAIL_PORT = 465,
    MAIL_SERVER = "mail server",
    MAIL_STARTTLS = False,
    MAIL_SSL_TLS = True,
    USE_CREDENTIALS = True,
    VALIDATE_CERTS = True
)

app = FastAPI()


html = """
<p>Thanks for using Fastapi-mail</p> 
"""


@app.post("/email")
async def simple_send(email: EmailSchema) -> JSONResponse:

    message = MessageSchema(
        subject="Fastapi-Mail module",
        recipients=email.dict().get("email"),
        body=html,
        subtype=MessageType.html)

    fm = FastMail(conf)
    await fm.send_message(message)
    return JSONResponse(status_code=200, content={"message": "email has been sent"})     
```

## List of Examples

For more examples of using fastapi-mail please check: 
[example](https://sabuhish.github.io/fastapi-mail/example/) section.


## Contributors ✨

Thanks goes to these wonderful
[People](https://github.com/sabuhish/fastapi-mail/blob/master/contributors.txt)


# Contributing
Contributions of any kind are welcome!

Before you start, please read [CONTRIBUTING](https://github.com/sabuhish/fastapi-mail/blob/master/CONTRIBUTING.md)


## LICENSE

[MIT](LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sabuhish/fastapi-mail",
    "name": "fastapi-mail",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Sabuhi Shukurov",
    "author_email": "sabuhi.shukurov@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5f/94/9fc53e33436368973071979bdb8cc31455e67daed4fbc301885459853d53/fastapi_mail-1.4.1.tar.gz",
    "platform": null,
    "description": "\n# Fastapi-mail\n\nThe fastapi-mail is a simple lightweight mail system, for sending emails and attachments(individual && bulk)\n\n\n[![MIT licensed](https://img.shields.io/github/license/sabuhish/fastapi-mail)](https://raw.githubusercontent.com/sabuhish/fastapi-mail/master/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/sabuhish/fastapi-mail.svg)](https://github.com/sabuhish/fastapi-mail/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/sabuhish/fastapi-mail.svg)](https://github.com/sabuhish/fastapi-mail/network)\n[![GitHub issues](https://img.shields.io/github/issues-raw/sabuhish/fastapi-mail)](https://github.com/sabuhish/fastapi-mail/issues)\n[![Downloads](https://pepy.tech/badge/fastapi-mail)](https://pepy.tech/project/fastapi-mail)\n\n\n###  \ud83d\udd28  Installation ###\n\n\n```bash\npython3 -m venv .venv\n\nsource .venv/bin/activate\n\npip install fastapi-mail\n\nfor aioredis and httpx\n\npip install 'fastapi-mail[aioredis]'\npip install 'fastapi-mail[httpx]'\n\n```\n\nAlternatively, if you prefer to use `poetry` for package dependencies:\n\n```bash\npoetry shell\n\npoetry add fastapi-mail\n\nfor aioredis and httpx\n\npoetry add 'fastapi-mail[aioredis]'\npoetry add 'fastapi-mail[httpx]'\n```\n\n---\n**Documentation**: [FastApi-MAIL](https://sabuhish.github.io/fastapi-mail/)\n---\n\n\nThe key features are:\n\n-  sending emails either with FastApi or using asyncio module \n-  sending emails using FastApi background task managment\n-  sending files either from form-data or files from server\n-  Using Jinja2 HTML Templates\n-  email utils (utility allows you to check temporary email addresses, you can block any email or domain)\n-  email utils has two available classes ```DefaultChecker``` and  ```WhoIsXmlApi```\n-  Unittests using FastapiMail\n\nMore information on [Getting-Started](https://sabuhish.github.io/fastapi-mail/getting-started/)\n\n\n### Guide\n\n\n```python\n\nfrom typing import List\n\nfrom fastapi import BackgroundTasks, FastAPI\nfrom fastapi_mail import ConnectionConfig, FastMail, MessageSchema, MessageType\nfrom pydantic import BaseModel, EmailStr\nfrom starlette.responses import JSONResponse\n\n\n\nclass EmailSchema(BaseModel):\n    email: List[EmailStr]\n\n\nconf = ConnectionConfig(\n    MAIL_USERNAME =\"username\",\n    MAIL_PASSWORD = \"**********\",\n    MAIL_FROM = \"test@email.com\",\n    MAIL_PORT = 465,\n    MAIL_SERVER = \"mail server\",\n    MAIL_STARTTLS = False,\n    MAIL_SSL_TLS = True,\n    USE_CREDENTIALS = True,\n    VALIDATE_CERTS = True\n)\n\napp = FastAPI()\n\n\nhtml = \"\"\"\n<p>Thanks for using Fastapi-mail</p> \n\"\"\"\n\n\n@app.post(\"/email\")\nasync def simple_send(email: EmailSchema) -> JSONResponse:\n\n    message = MessageSchema(\n        subject=\"Fastapi-Mail module\",\n        recipients=email.dict().get(\"email\"),\n        body=html,\n        subtype=MessageType.html)\n\n    fm = FastMail(conf)\n    await fm.send_message(message)\n    return JSONResponse(status_code=200, content={\"message\": \"email has been sent\"})     \n```\n\n## List of Examples\n\nFor more examples of using fastapi-mail please check: \n[example](https://sabuhish.github.io/fastapi-mail/example/) section.\n\n\n## Contributors \u2728\n\nThanks goes to these wonderful\n[People](https://github.com/sabuhish/fastapi-mail/blob/master/contributors.txt)\n\n\n# Contributing\nContributions of any kind are welcome!\n\nBefore you start, please read [CONTRIBUTING](https://github.com/sabuhish/fastapi-mail/blob/master/CONTRIBUTING.md)\n\n\n## LICENSE\n\n[MIT](LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple lightweight mail library for FastApi",
    "version": "1.4.1",
    "project_urls": {
        "Homepage": "https://github.com/sabuhish/fastapi-mail",
        "Repository": "https://github.com/sabuhish/fastapi-mail"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89a3c94fac41f430dd1a5586061aed04c5f1f6478b488a581d0b7c0b7c95ea76",
                "md5": "04e2b0892815410047039e9b50ae993c",
                "sha256": "fa5ef23b2dea4d3ba4587f4bbb53f8f15274124998fb4e40629b3b636c76c398"
            },
            "downloads": -1,
            "filename": "fastapi_mail-1.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04e2b0892815410047039e9b50ae993c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0",
            "size": 14736,
            "upload_time": "2023-07-18T18:53:18",
            "upload_time_iso_8601": "2023-07-18T18:53:18.667567Z",
            "url": "https://files.pythonhosted.org/packages/89/a3/c94fac41f430dd1a5586061aed04c5f1f6478b488a581d0b7c0b7c95ea76/fastapi_mail-1.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f949fc53e33436368973071979bdb8cc31455e67daed4fbc301885459853d53",
                "md5": "3eed0d57772586b64165d0ee00fa9e45",
                "sha256": "9095b713bd9d3abb02fe6d7abb637502aaf680b52e177d60f96273ef6bc8bb70"
            },
            "downloads": -1,
            "filename": "fastapi_mail-1.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3eed0d57772586b64165d0ee00fa9e45",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0",
            "size": 13301,
            "upload_time": "2023-07-18T18:53:20",
            "upload_time_iso_8601": "2023-07-18T18:53:20.407825Z",
            "url": "https://files.pythonhosted.org/packages/5f/94/9fc53e33436368973071979bdb8cc31455e67daed4fbc301885459853d53/fastapi_mail-1.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-18 18:53:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sabuhish",
    "github_project": "fastapi-mail",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "fastapi-mail"
}
        
Elapsed time: 0.13683s