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