Код: Выделить всё
message = Mail(
from_email=Email(SENDGRID_FROM_EMAIL, "noreply@test.com"),
to_emails=To(to_email),
subject="Subject line",
html_content=Content("text/html", html_content)
)
try:
response = client.send(message)
logger.info(f"Email sent to {to_email}, status: {response.status_code}")
return response.status_code in [200, 201, 202]
except Exception as e:
logger.error(f"Failed to send invite email to {to_email}: {e}")
return False
Подробнее здесь: https://stackoverflow.com/questions/798 ... rified-sen
Мобильная версия