mirror of
https://github.com/FAUSheppy/oh-my-nemesis
synced 2025-12-06 06:51:35 +01:00
Initial (reset)
This commit is contained in:
20
pages_api.py
Normal file
20
pages_api.py
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
import flask
|
||||
import smtplib
|
||||
|
||||
import jsonConfig as jc
|
||||
|
||||
pagesApi = flask.Blueprint('simple_page', __name__, template_folder='templates')
|
||||
|
||||
@pagesApi.route("/contact-api", methods=['POST'])
|
||||
def contactAPI():
|
||||
|
||||
email = flask.request.form["email"]
|
||||
name = flask.request.form["name"]
|
||||
subject = "Subject: {} ({})\n\n".format(flask.request.form["subject"], name)
|
||||
message = subject + flask.request.form["message"]
|
||||
smtpTarget = smtplib.SMTP(jc.mainConfig().smtp)
|
||||
smtpTarget.sendmail(email, jc.mainConfig().target_email , message)
|
||||
smtpTarget.quit()
|
||||
|
||||
return flask.redirect("/thanks")
|
||||
Reference in New Issue
Block a user