Flask Mail
from flask_mail import Mail, Message
mail = Mail(app)
@app.route('/send_email')
def send_mail():
msg = Message('Hello', sender='sender@example.com', recipients=['recipient@example.com'])
msg.body = 'This is an email.'
mail.send(msg)
return 'Email sent!'from flask_mail import Mail, Message
mail = Mail(app)
@app.route('/send_html_email')
def send_html_email():
msg = Message('HTML Email', sender='sender@example.com', recipients=['recipient@example.com'])
msg.html = '<p>This is an HTML email.</p>'
mail.send(msg)
return 'HTML Email sent!'