-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
48 lines (38 loc) · 1.18 KB
/
app.py
File metadata and controls
48 lines (38 loc) · 1.18 KB
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
38
39
40
41
42
43
44
45
46
47
48
from flask import Flask,request,flash,render_template
from flask_mail import Mail,Message
app =Flask(__name__)
app.secret_key="123"
@app.route("/")
def home():
return render_template('index.html')
@app.route("/about")
def about():
return render_template('about.html')
@app.route("/resume")
def resume():
return render_template('resume.html')
@app.route("/test")
def resume():
return 'Test'
@app.route("/contact",methods=["POST","GET"])
def contact():
if request.method=="POST":
fmail=request.form.get('fmail')
tmail = request.form.get('tmail')
fpwd = request.form.get('fpwd')
message = request.form.get('message')
body = request.form.get('body')
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT']=465
app.config['MAIL_USERNAME']=fmail
app.config['MAIL_PASSWORD']=fpwd
app.config['MAIL_USE_TLS']=False
app.config['MAIL_USE_SSL']=True
mail = Mail(app)
msg=Message(message,sender=fmail,recipients=[tmail])
msg.body=body
mail.send(msg)
flash("Mail Sented Successfully", 'success')
return render_template('contact.html')
if __name__ == '__main__':
app.run(debug = True)