<gh_stars>0
from flask import request, Flask
from flask_mail import Mail, Message

app = Flask(__name__)
mail = Mail(app)

@app.route("/send")
def send():
  msg = Message(subject="Subject",
                sender="<EMAIL>",
                recipients=["<EMAIL>"],
                body="plain-text body",
                html=request.args["html"])

  # The message can contain a body and/or HTML:
  msg.body = "plain-text body"
  # The email's HTML can be set via msg.html or as an initialize argument when creating a Message object.
  msg.html = request.args["html"]

  mail.send(msg)

@app.route("/connect")
def connect():
  """
  Minimal example to test mail.connect() usage
  """
  with mail.connect() as conn:
    msg = Message(subject="Subject",
                  sender="<EMAIL>",
                  recipients=["<EMAIL>"],
                  html=request.args["html"])
    conn.send(msg)

from flask import request, Flask
from flask_mail import Mail, Message

app = Flask(__name__)
mail = Mail(app)

@app.route("/send")
def send():
  msg = Message(subject="Subject",
                sender="<EMAIL>",
                recipients=["<EMAIL>"],
                body="plain-text body",
                html=request.args["html"])

  # The message can contain a body and/or HTML:
  msg.body = "plain-text body"
  # The email's HTML can be set via msg.html or as an initialize argument when creating a Message object.
  msg.html = request.args["html"]

  mail.send(msg)

@app.route("/connect")
def connect():
  """
  Minimal example to test mail.connect() usage
  """
  with mail.connect() as conn:
    msg = Message(subject="Subject",
                  sender="<EMAIL>",
                  recipients=["<EMAIL>"],
                  html=request.args["html"])
    conn.send(msg)
# The message can contain a body and/or HTML: # The email's HTML can be set via msg.html or as an initialize argument when creating a Message object. Minimal example to test mail.connect() usage