Commit 1d40f9d8 authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

integrating mailing

parent efd170e7
from app import app
from flask_mail import Mail, Message
from flask import render_template, request, redirect, url_for, session, send_from_directory, flash
from flask_mail import Message
import psycopg2
import app.dao.user.user as ud
......@@ -23,6 +25,7 @@ MAX_PG_ENTRIES_USERS = 10
MAX_PG_ENTRIES_DATA = 10
MAX_PG_ENTRIES_GRAPH_HOURS = 24
mail = Mail(app)
@app.route('/')
def index():
......@@ -583,5 +586,22 @@ def alarm_rm():
else:
return redirect(url_for('index'))
@app.route('/mail')
def send_mail():
print (1)
msg = Message('test message',
sender = 'hpcaiotserver@gmail.com',
recipients = ['al373630@uji.es'])
print (2)
msg.body = 'Hello vlad, alert is here!'
print (3)
res = mail.send(msg)
print (res)
return res
def pend_delete_all_ack():
pend.delete_all_ack()
......@@ -24,6 +24,13 @@ class Config(object):
# manual user signup by default
USERS_SIGNUP = False
# mail server config
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USERNAME = 'hpcaiotserver@gmail.com'
MAIL_PASSWORD = 'HPC&A10T.'
class ProductionConfig(Config):
pass
......
APScheduler==3.6.3
bcrypt==3.1.7
blinker==1.4
cffi==1.14.0
click==7.1.1
Flask==1.1.2
Flask-Mail==0.9.1
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment