18 lines
415 B
Python
18 lines
415 B
Python
|
from flask_mail import Message
|
||
|
|
||
|
from app import flask_mail
|
||
|
|
||
|
from app.mail.message_content import MessageContent
|
||
|
|
||
|
|
||
|
def send_mail(message: MessageContent, recipient: str):
|
||
|
|
||
|
msg = Message(subject=message.subject, recipients=[recipient], body=message.body)
|
||
|
|
||
|
try:
|
||
|
flask_mail.send(msg)
|
||
|
return True
|
||
|
except Exception as e:
|
||
|
print(f"Failed to send email. Error: {e}")
|
||
|
return False
|