diff --git a/main.py b/main.py index 5364828..c3592a5 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,12 @@ @app.route("/", methods=["POST", "GET"]) def mail(): if request.method == "POST": - sg = sendgrid.SendGridAPIClient(apikey=SENDGRID_API_KEY) + if request.form.get("api_key"): + api_key_selected = request.form.get("api_key") + else: + api_key_selected = SENDGRID_API_KEY + + sg = sendgrid.SendGridAPIClient(apikey=api_key_selected) from_email = Email(request.form.get("from_email")) to_email = Email(request.form.get("to_email")) subject = request.form.get("subject") @@ -28,6 +33,7 @@ def mail():