Give the mail delivery a try - fail
This commit is contained in:
parent
e6fd7110e6
commit
37ab6ba6ca
@ -2,6 +2,8 @@ from flask import Flask, render_template, request, redirect, url_for
|
||||
import uuid
|
||||
import csv
|
||||
import os
|
||||
import smtplib
|
||||
from email.message import EmailMessage
|
||||
from wtforms import Form, StringField, SelectField, RadioField, TextAreaField, BooleanField, validators
|
||||
from wtforms.fields.html5 import EmailField
|
||||
|
||||
@ -11,6 +13,7 @@ app.jinja_env.lstrip_blocks = True
|
||||
|
||||
datafile = "data.csv"
|
||||
solutionfile = "solutions.csv"
|
||||
mailfile = "mail.csv"
|
||||
|
||||
def check_input(form, field):
|
||||
if field.data == 'default':
|
||||
@ -60,6 +63,20 @@ class AnswerForm(Form):
|
||||
def index():
|
||||
return render_template('index.html', title='Sortierhut')
|
||||
|
||||
def send_mail(user_id):
|
||||
with open(mailfile) as f:
|
||||
msg = EmailMessage()
|
||||
msg.set_content(f.read())
|
||||
|
||||
msg['Subject'] = 'Deine Sortierhut-ID'
|
||||
msg['From'] = 'anna-carina-dorothea.sauer@stud.uni-bamberg.de'
|
||||
msg['To'] = 'anna-carina-dorothea.sauer@stud.uni-bamberg.de'
|
||||
|
||||
s = smtplib.SMTP('localhost')
|
||||
s.send_message(msg)
|
||||
s.quit()
|
||||
return
|
||||
|
||||
@app.route('/questions', methods=['GET', 'POST'])
|
||||
def questions():
|
||||
form = QuestionForm(request.form)
|
||||
|
||||
@ -22,5 +22,10 @@
|
||||
</nav>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
<footer>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>© Fachschaft WIAI aamma & smartin & asauer 2019</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
{{ render_field(form.spirit_animal) }}
|
||||
{{ render_field(form.operating_system) }}
|
||||
{{ form.check }} {{ form.check.label }}
|
||||
{{ render_field(form.email) }}
|
||||
<p></p>
|
||||
<p><input type=submit value=Abschicken>
|
||||
</form>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user