forked from MarseyWorld/MarseyWorld
gfdf
parent
7e9cbddc39
commit
2895799c71
|
@ -64,7 +64,7 @@ app.config["RATELIMIT_STORAGE_URL"] = environ.get("REDIS_URL", "redis://127.0.0.
|
||||||
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
|
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
|
||||||
app.config['MAIL_PORT'] = 587
|
app.config['MAIL_PORT'] = 587
|
||||||
app.config['MAIL_USE_TLS'] = True
|
app.config['MAIL_USE_TLS'] = True
|
||||||
app.config['MAIL_USERNAME'] = 'Aevann3@gmail.com'
|
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
|
||||||
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
||||||
|
|
||||||
r=redis.Redis(host=environ.get("REDIS_URL", "redis://127.0.0.1"), decode_responses=True, ssl_cert_reqs=None)
|
r=redis.Redis(host=environ.get("REDIS_URL", "redis://127.0.0.1"), decode_responses=True, ssl_cert_reqs=None)
|
||||||
|
|
|
@ -7,30 +7,17 @@ from urllib.parse import quote
|
||||||
from files.helpers.security import *
|
from files.helpers.security import *
|
||||||
from files.helpers.wrappers import *
|
from files.helpers.wrappers import *
|
||||||
from files.classes import *
|
from files.classes import *
|
||||||
from files.__main__ import app
|
from files.__main__ import app, mail
|
||||||
|
from flask_mail import Message
|
||||||
|
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
name = environ.get("SITE_NAME").strip()
|
name = environ.get("SITE_NAME").strip()
|
||||||
mailgun_domain = environ.get("MAILGUN_DOMAIN", "").strip()
|
|
||||||
|
|
||||||
def send_mail(to_address, subject, html, plaintext=None, files={},
|
|
||||||
from_address=f"{name} <noreply@mail.{site}>"):
|
|
||||||
|
|
||||||
url = f"https://api.mailgun.net/v3/{mailgun_domain}/messages"
|
def send_mail(to_address, subject, html):
|
||||||
|
|
||||||
data = {"from": from_address,
|
msg = Message(html=html, subject=subject, sender="rdrama@rdrama.net", recipients=[to_address])
|
||||||
"to": [to_address],
|
mail.send(msg)
|
||||||
"subject": subject,
|
|
||||||
"text": plaintext,
|
|
||||||
"html": html,
|
|
||||||
}
|
|
||||||
|
|
||||||
return requests.post(url,
|
|
||||||
auth=(
|
|
||||||
"api", environ.get("MAILGUN_KEY").strip()),
|
|
||||||
data=data,
|
|
||||||
files=[("attachment", (k, files[k])) for k in files]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def send_verification_email(user, email=None):
|
def send_verification_email(user, email=None):
|
||||||
|
|
|
@ -6,19 +6,10 @@ from sqlalchemy import func
|
||||||
from os import path
|
from os import path
|
||||||
import calendar
|
import calendar
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from flask_mail import Message
|
|
||||||
|
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
site_name = environ.get("SITE_NAME").strip()
|
site_name = environ.get("SITE_NAME").strip()
|
||||||
|
|
||||||
@app.route("/mailtest")
|
|
||||||
def mailtest():
|
|
||||||
msg = Message(html="<h1>Hello<h1>",
|
|
||||||
sender="rdrama@rdrama.net",
|
|
||||||
recipients=["randomname42029@gmail.com"])
|
|
||||||
mail.send(msg)
|
|
||||||
return "sex"
|
|
||||||
|
|
||||||
@app.get('/rules')
|
@app.get('/rules')
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def static_rules(v):
|
def static_rules(v):
|
||||||
|
|
Loading…
Reference in New Issue