forked from rDrama/rDrama
add a 2nd email account for WPD
parent
2ec5531080
commit
a75d481f60
|
@ -16,6 +16,7 @@ import time
|
|||
from sys import stdout, argv
|
||||
import faulthandler
|
||||
import json
|
||||
import random
|
||||
|
||||
app = Flask(__name__, template_folder='templates')
|
||||
app.url_map.strict_slashes = False
|
||||
|
@ -43,6 +44,11 @@ app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL", "redis://localhost")
|
|||
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
|
||||
app.config['MAIL_PORT'] = 587
|
||||
app.config['MAIL_USE_TLS'] = True
|
||||
|
||||
if environ.get("MAIL_USERNAME2") and random.random() < 0.5:
|
||||
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME2", "").strip()
|
||||
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD2", "").strip()
|
||||
else:
|
||||
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
|
||||
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from flask_mail import Message
|
|||
|
||||
def send_mail(to_address, subject, html):
|
||||
|
||||
msg = Message(html=html, subject=subject, sender=f"{SITE_NAME}@{SITE}", recipients=[to_address])
|
||||
msg = Message(html=html, subject=subject, sender=app.config['MAIL_USERNAME'], recipients=[to_address])
|
||||
mail.send(msg)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue