-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
31 lines (22 loc) · 874 Bytes
/
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
from flask import Flask, request, render_template
from flask_mail import Mail, Message
app = Flask(__name__)
@app.route('/',methods=['POST','GET'])
def index():
return render_template('MyMailProjForm.html')
@app.route('/sent', methods=['POST','GET'])
def login():
#print(list(request.form['re'].split(",")),"***************************")
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = request.form['se']
app.config['MAIL_PASSWORD'] = request.form['pa']
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
mail = Mail(app)
msg = Message(request.form['su'], sender= request.form['se'], recipients=list(request.form['re'].split(",")))
msg.body = request.form['bo']
mail.send(msg)
return "Mail Sent"
if __name__ == '__main__':
app.run(debug=True)