no need to fill up message-id header: it seems always filled

This commit is contained in:
Son 2021-10-18 17:34:11 +02:00
parent 1483f2e103
commit 9c653dbacd
1 changed files with 2 additions and 9 deletions

View File

@ -136,6 +136,7 @@ from app.models import (
Bounce,
TransactionalEmail,
IgnoredEmail,
MessageIDMatching,
)
from app.pgp_utils import PGPException, sign_data_with_pgpy, sign_data
from app.utils import sanitize_email
@ -671,6 +672,7 @@ def forward_email_to_mailbox(
user_id=user.id,
mailbox_id=mailbox.id,
alias_id=contact.alias_id,
message_id=msg[headers.MESSAGE_ID],
commit=True,
)
LOG.d("Create %s for %s, %s, %s", email_log, contact, user, mailbox)
@ -775,11 +777,6 @@ def forward_email_to_mailbox(
# when an alias isn't in the To: header, there's no way for users to know what alias has received the email
msg[headers.SL_ENVELOPE_TO] = alias.email
if not msg[headers.MESSAGE_ID]:
LOG.w("missing message id header, create one")
message_id = make_msgid(str(email_log.id), EMAIL_DOMAIN)
msg[headers.MESSAGE_ID] = message_id
if not msg[headers.DATE]:
LOG.w("missing date header, create one")
msg[headers.DATE] = formatdate()
@ -1024,10 +1021,6 @@ def handle_reply(envelope, msg: Message, rcpt_to: str) -> (bool, str):
replace_header_when_reply(msg, alias, headers.TO)
replace_header_when_reply(msg, alias, headers.CC)
if not msg[headers.MESSAGE_ID]:
message_id = make_msgid(str(email_log.id), get_email_domain_part(alias.email))
LOG.w("missing message id, add one %s", message_id)
msg[headers.MESSAGE_ID] = message_id
if not msg[headers.DATE]:
date_header = formatdate()