From a512fbc6e5ffb1e6bf26c8155497af2f64ea438f Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Thu, 21 May 2020 20:43:03 +0200 Subject: [PATCH] use POSTFIX_PORT instead of 25 if it's set --- app/email_utils.py | 3 ++- email_handler.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/email_utils.py b/app/email_utils.py index a793e692..b4e60458 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -26,6 +26,7 @@ from app.config import ( MAX_NB_EMAIL_FREE_PLAN, DISPOSABLE_EMAIL_DOMAINS, MAX_ALERT_24H, + POSTFIX_PORT, ) from app.dns_utils import get_mx_domains from app.extensions import db @@ -197,7 +198,7 @@ def send_email( smtp = SMTP(POSTFIX_SERVER, 587) smtp.starttls() else: - smtp = SMTP(POSTFIX_SERVER, 25) + smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT or 25) if bounced_email: msg = MIMEMultipart("mixed") diff --git a/email_handler.py b/email_handler.py index 8a1e5821..c81795a8 100644 --- a/email_handler.py +++ b/email_handler.py @@ -62,6 +62,7 @@ from app.config import ( ALERT_BOUNCE_EMAIL, ALERT_SPAM_EMAIL, ALERT_SPF, + POSTFIX_PORT, ) from app.email_utils import ( send_email, @@ -1018,7 +1019,7 @@ class MailHandler: smtp = SMTP(POSTFIX_SERVER, 587) smtp.starttls() else: - smtp = SMTP(POSTFIX_SERVER, 25) + smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT or 25) app = new_app() with app.app_context():