Use alias name in reply phase

This commit is contained in:
Son NK 2020-04-26 10:41:24 +02:00
parent 7021fd650b
commit 3063fee472
1 changed files with 6 additions and 1 deletions

View File

@ -513,7 +513,12 @@ def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, str
delete_header(msg, "Received")
# make the email comes from alias
add_or_replace_header(msg, "From", alias.email)
if alias.name:
LOG.d("Put alias name in from header")
from_header = formataddr((alias.name, alias.email))
else:
from_header = alias.email
add_or_replace_header(msg, "From", from_header)
# some email providers like ProtonMail adds automatically the Reply-To field
# make sure to delete it