Skip to content
المشاريع

حول

نظام بريد لـ FastAPI يتيح إرسال الرسائل إلى أفراد أو مجموعات، وإرفاق الملفات بمرفقات فردية أو متعددة.

تطوير الويب والتطبيقات

كيف تُقاس هذه الأرقام

1,018 نجمة112 التفرعات +1 خلال 24 ساعة

النمو المقاس للنجوم

خلال 24 ساعة
+١
خلال 7 أيام
٠
خلال 15 يومًا
+٢
خلال شهر
+١

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

Fastapi-mail

Simple lightweight mail system for FastAPI — send emails, attachments, and HTML templates.

MIT licensed GitHub stars GitHub issues Downloads

Documentation: sabuhish.github.io/fastapi-mail


Installation

pip install fastapi-mail

Quick Start

from typing import List

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


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


conf = ConnectionConfig(
    MAIL_USERNAME="username",
    MAIL_PASSWORD="**********",
    MAIL_FROM="[email protected]",
    MAIL_PORT=465,
    MAIL_SERVER="mail server",
    MAIL_STARTTLS=False,
    MAIL_SSL_TLS=True,
    USE_CREDENTIALS=True,
    VALIDATE_CERTS=True,
)

app = FastAPI()


@app.post("/email")
async def simple_send(email: EmailSchema) -> JSONResponse:
    message = MessageSchema(
        subject="Fastapi-Mail module",
        recipients=email.model_dump().get("email"),
        body="<p>Thanks for using Fastapi-mail</p>",
        subtype=MessageType.html,
    )
    await FastMail(conf).send_message(message)
    return JSONResponse(status_code=200, content={"message": "email has been sent"})

Contributing

Contributions of any kind are welcome! Please read CONTRIBUTING before you start.

Contributors

Thanks goes to these wonderful people.

LICENSE

MIT

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…