Dmarc transactional (#1402)
* make sure transactional email use the same domain for header from and envelope from * fix import
This commit is contained in:
parent
5bbf6a2654
commit
25743da161
|
@ -299,6 +299,7 @@ def send_email(
|
|||
|
||||
from_name = from_name or NOREPLY
|
||||
from_addr = from_addr or NOREPLY
|
||||
from_domain = get_email_domain_part(from_addr)
|
||||
|
||||
if html:
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
@ -337,7 +338,7 @@ def send_email(
|
|||
|
||||
# use a different envelope sender for each transactional email (aka VERP)
|
||||
sl_sendmail(
|
||||
generate_verp_email(VerpType.transactional, transaction.id),
|
||||
generate_verp_email(VerpType.transactional, transaction.id, from_domain),
|
||||
to_email,
|
||||
msg,
|
||||
retries=retries,
|
||||
|
|
|
@ -14,7 +14,12 @@ import sqlalchemy
|
|||
from app import config
|
||||
from app.db import Session
|
||||
from app.email import headers
|
||||
from app.email_utils import generate_verp_email, render, add_dkim_signature
|
||||
from app.email_utils import (
|
||||
generate_verp_email,
|
||||
render,
|
||||
add_dkim_signature,
|
||||
get_email_domain_part,
|
||||
)
|
||||
from app.mail_sender import sl_sendmail
|
||||
from app.models import (
|
||||
Alias,
|
||||
|
@ -147,7 +152,11 @@ class ExportUserDataJob:
|
|||
|
||||
transaction = TransactionalEmail.create(email=to_email, commit=True)
|
||||
sl_sendmail(
|
||||
generate_verp_email(VerpType.transactional, transaction.id),
|
||||
generate_verp_email(
|
||||
VerpType.transactional,
|
||||
transaction.id,
|
||||
get_email_domain_part(config.NOREPLY),
|
||||
),
|
||||
to_email,
|
||||
msg,
|
||||
ignore_smtp_error=False,
|
||||
|
|
|
@ -6,8 +6,8 @@ import os
|
|||
import time
|
||||
import uuid
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from email.message import Message
|
||||
from functools import wraps
|
||||
from mailbox import Message
|
||||
from smtplib import SMTP, SMTPException
|
||||
from typing import Optional, Dict, List, Callable
|
||||
|
||||
|
|
|
@ -1315,7 +1315,7 @@ Email sent on behalf of alias {alias.email} using mailbox {mailbox.email}""",
|
|||
# this notif is considered transactional email
|
||||
transaction = TransactionalEmail.create(email=other_mb.email, commit=True)
|
||||
sl_sendmail(
|
||||
generate_verp_email(VerpType.transactional, transaction.id),
|
||||
generate_verp_email(VerpType.transactional, transaction.id, alias_domain),
|
||||
other_mb.email,
|
||||
notif,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue