smtp funktioniert mit Variablen
This commit is contained in:
9
app.py
9
app.py
@@ -4,9 +4,9 @@ import smtplib, ssl
|
|||||||
port = 587 # For starttls
|
port = 587 # For starttls
|
||||||
smtp_server = "smtp.gmail.com"
|
smtp_server = "smtp.gmail.com"
|
||||||
sender_email = "patha9201@gmail.com"
|
sender_email = "patha9201@gmail.com"
|
||||||
receiver_email = "patha9201@gmail.com"
|
# receiver_email = "patha9201@gmail.com"
|
||||||
password = "dqlw ablc clic uvgp"
|
password = "dqlw ablc clic uvgp"
|
||||||
message = "test"
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@@ -23,8 +23,9 @@ def form():
|
|||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render_template('form.html')
|
return render_template('form.html')
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
user = request.form['name']
|
receiver = request.form['name']
|
||||||
mail = request.form['email']
|
receiver_email = request.form['email']
|
||||||
|
message = f"Sehr geehrter Herr {receiver},"
|
||||||
|
|
||||||
context = ssl.create_default_context()
|
context = ssl.create_default_context()
|
||||||
with smtplib.SMTP(smtp_server, port) as server:
|
with smtplib.SMTP(smtp_server, port) as server:
|
||||||
|
|||||||
Reference in New Issue
Block a user