-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
37 lines (28 loc) · 1.16 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from flask import Flask,request
from flask import render_template
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
#smtp_server = smtplib.SMTP("smtp.gmail.com", 587)
#smtp_server.starttls()
#smtp_server.login("[email protected]", "your_password")
def email(name,email,phone):
msg = MIMEMultipart()
msg["From"] = "[email protected]"
msg["To"] = "[email protected]"
text = "Привет! C тобой хочет связаться {name} вот его почта: {email} и его номер телефона: {phone}"
msg.attach(MIMEText(text, "plain"))
smtp_server.sendmail("[email protected]", "[email protected]", msg.as_string())
smtp_server.quit()
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
name = request.form.get('name')
phone = request.form.get('email')
email = request.form.get('phone')
#email(name,email,phone)
return "Ok"
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True)