-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
I had this problem today when I was testing, which was puzzling, my settings entry was this:
mail_username: str = "1234@qq.com"
mail_password: str = "123144"
mail_from: str = "1234@qq.com"
mail_port: int = 465
mail_server: str = "smtp.qq.com"
mail_from_name: str = "GoWhere"
mail_starttls: bool = False
mail_ssl_tls: bool = True
mail_use_credentials: bool = True
mail_validate_certs: bool = False
conf = ConnectionConfig(
MAIL_USERNAME= settings.mail_username,
MAIL_PASSWORD= settings.mail_password,
MAIL_FROM= settings.mail_from,
MAIL_PORT= settings.mail_port,
MAIL_SERVER= settings.mail_server,
MAIL_FROM_NAME= settings.mail_from_name,
MAIL_STARTTLS= settings.mail_starttls,
MAIL_SSL_TLS= settings.mail_ssl_tls,
USE_CREDENTIALS= settings.mail_use_credentials,
VALIDATE_CERTS= settings.mail_validate_certs,
TEMPLATE_FOLDER= Path("D:/GOWHERE/Back_End/templates/email/"),
SUPPRESS_SEND = 0
)
The test interface I wrote:
@router.post("/send_template_email")
async def send_template_email(email_data: EmailSchema):
message = MessageSchema(
recipients=email_data.recipients,
subject=email_data.subject,
body= "html_content",
subtype="html",
)
fm = FastMail(conf)
await fm.send_message(message)
return JSONResponse(
status_code=200, content={"message": "email has been sent"}
)
I checked many places, but couldn't find the error.
Metadata
Metadata
Assignees
Labels
No labels