send at max 1 email / 30 days for DNS issue on custom domain

This commit is contained in:
Son NK 2020-08-31 17:36:27 +02:00
parent 85b87bbacb
commit 4cb3e54821
2 changed files with 9 additions and 1 deletions

View file

@ -295,6 +295,8 @@ ALERT_SPF = "spf"
# then later adds this domain into SimpleLogin
ALERT_MAILBOX_IS_ALIAS = "mailbox_is_alias"
AlERT_WRONG_MX_RECORD_CUSTOM_DOMAIN = "custom_domain_mx_record_issue"
# <<<<< END ALERT EMAIL >>>>
# Disable onboarding emails

View file

@ -15,6 +15,7 @@ from app.config import (
APPLE_API_SECRET,
EMAIL_SERVERS_WITH_PRIORITY,
URL,
AlERT_WRONG_MX_RECORD_CUSTOM_DOMAIN,
)
from app.dns_utils import get_mx_domains
from app.email_utils import (
@ -22,6 +23,7 @@ from app.email_utils import (
send_trial_end_soon_email,
render,
email_domain_can_be_used_as_mailbox,
send_email_with_rate_control,
)
from app.extensions import db
from app.log import LOG
@ -337,7 +339,9 @@ def check_custom_domain():
domain_dns_url = f"{URL}/dashboard/domains/{custom_domain.id}/dns"
send_email(
send_email_with_rate_control(
user,
AlERT_WRONG_MX_RECORD_CUSTOM_DOMAIN,
user.email,
f"Please update {custom_domain.domain} DNS on SimpleLogin",
render(
@ -352,6 +356,8 @@ def check_custom_domain():
name=user.name or "",
domain_dns_url=domain_dns_url,
),
max_nb_alert=1,
nb_day=30,
)