fastapi / full-stack-fastapi-template

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.
MIT License
27.95k stars 5k forks source link

🐛 Fix log print for utils #1373

Closed ihmily closed 2 months ago

ihmily commented 2 months ago

In the code, there is only this line: https://github.com/fastapi/full-stack-fastapi-template/blob/451c656fb052c9ff00e0da507a42d549c0f184cb/backend/app/utils.py#L1

response = message.send(to=email_to, smtp=smtp_options)
logging.info(f"send email result: {response}")

Without any log configuration (such as setting the log level, format, and handler), in most cases, this log message will not be displayed on the console, nor will it be automatically recorded in a log file. https://github.com/fastapi/full-stack-fastapi-template/blob/451c656fb052c9ff00e0da507a42d549c0f184cb/backend/app/utils.py#L50C1-L51C51

I can't see the log <emails.backend.SMTPResponse status_code=501 status_text=b'Mail from address must be same as authorization user.'>