use send_by_postfix instead of sending bounce email directly

This commit is contained in:
Son NK 2019-12-15 18:27:07 +02:00
parent 7e76c3a0a9
commit 615e2a4d91
1 changed files with 6 additions and 5 deletions

View File

@ -38,8 +38,8 @@ from smtplib import SMTP
from aiosmtpd.controller import Controller
from app.config import EMAIL_DOMAIN, POSTFIX_SERVER, URL, SUPPORT_EMAIL
from app.email_utils import get_email_name, get_email_part
from app.config import EMAIL_DOMAIN, POSTFIX_SERVER, URL
from app.email_utils import get_email_name, get_email_part, send_by_postfix
from app.extensions import db
from app.log import LOG
from app.models import GenEmail, ForwardEmail, ForwardEmailLog
@ -223,10 +223,11 @@ class MailHandler:
user_email,
)
smtp.sendmail(
SUPPORT_EMAIL,
send_by_postfix(
envelope.mail_from,
f"You cannot send email to {reply_email}",
f"Your email ({envelope.mail_from}) is not allowed to send email to {reply_email}",
"",
"",
)
return "250 ignored"