mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-02 04:44:25 +01:00
Fix sending emails when CTF name contains colons (#1560)
* Fixes issue with sending emails if the CTF name has a colon * Closes #1558
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from email.utils import formataddr
|
||||
|
||||
import requests
|
||||
|
||||
from CTFd.utils import get_app_config, get_config
|
||||
@@ -6,7 +8,7 @@ from CTFd.utils import get_app_config, get_config
|
||||
def sendmail(addr, text, subject):
|
||||
ctf_name = get_config("ctf_name")
|
||||
mailfrom_addr = get_config("mailfrom_addr") or get_app_config("MAILFROM_ADDR")
|
||||
mailfrom_addr = "{} <{}>".format(ctf_name, mailfrom_addr)
|
||||
mailfrom_addr = formataddr((ctf_name, mailfrom_addr))
|
||||
|
||||
mailgun_base_url = get_config("mailgun_base_url") or get_app_config(
|
||||
"MAILGUN_BASE_URL"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import smtplib
|
||||
from email.message import EmailMessage
|
||||
from email.utils import formataddr
|
||||
from socket import timeout
|
||||
|
||||
from CTFd.utils import get_app_config, get_config
|
||||
@@ -22,7 +23,7 @@ def get_smtp(host, port, username=None, password=None, TLS=None, SSL=None, auth=
|
||||
def sendmail(addr, text, subject):
|
||||
ctf_name = get_config("ctf_name")
|
||||
mailfrom_addr = get_config("mailfrom_addr") or get_app_config("MAILFROM_ADDR")
|
||||
mailfrom_addr = "{} <{}>".format(ctf_name, mailfrom_addr)
|
||||
mailfrom_addr = formataddr((ctf_name, mailfrom_addr))
|
||||
|
||||
data = {
|
||||
"host": get_config("mail_server") or get_app_config("MAIL_SERVER"),
|
||||
|
||||
Reference in New Issue
Block a user