From 8d2b342c81545ec642933d12511fee5395f1ee8f Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 8 Jan 2023 20:40:07 +0200 Subject: [PATCH] use my own email server --- files/helpers/mail.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/files/helpers/mail.py b/files/helpers/mail.py index 6c2ae4e31..776cc5fc8 100644 --- a/files/helpers/mail.py +++ b/files/helpers/mail.py @@ -9,15 +9,25 @@ from urllib.parse import quote from flask import render_template def send_mail(to_address, subject, html): - if MAILGUN_KEY == DEFAULT_CONFIG_VALUE: return - url = f"https://api.mailgun.net/v3/{SITE}/messages" - auth = ("api", MAILGUN_KEY) - data = {"from": EMAIL, - "to": [to_address], - "subject": subject, - "html": html, - } - requests.post(url, auth=auth, data=data) + if SITE == 'rdrama.net': + url = f"https://deuxrama.net/email" + data = {"from": EMAIL, + "to": to_address, + "subject": subject, + "html": html, + } + x = requests.post(url, data=data) + print(x.text, flush=True) + else: + if MAILGUN_KEY == DEFAULT_CONFIG_VALUE: return + url = f"https://api.mailgun.net/v3/{SITE}/messages" + auth = ("api", MAILGUN_KEY) + data = {"from": EMAIL, + "to": [to_address], + "subject": subject, + "html": html, + } + requests.post(url, auth=auth, data=data) def send_verification_email(user, email=None):