simplify code: replace mailbox_email by mailbox.email

This commit is contained in:
Son NK 2020-05-10 16:32:54 +02:00
parent 59036972f1
commit 2755e67c31
1 changed files with 3 additions and 4 deletions

View File

@ -336,7 +336,6 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
return True, "250 Message accepted for delivery" return True, "250 Message accepted for delivery"
mailbox = alias.mailbox mailbox = alias.mailbox
mailbox_email = mailbox.email
user = alias.user user = alias.user
spam_check = True spam_check = True
@ -356,7 +355,7 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
email_log.is_spam = True email_log.is_spam = True
email_log.spam_status = spam_status email_log.spam_status = spam_status
handle_spam(contact, alias, msg, user, mailbox_email, email_log) handle_spam(contact, alias, msg, user, mailbox.email, email_log)
return False, "550 SL E1" return False, "550 SL E1"
# add custom header # add custom header
@ -406,7 +405,7 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
LOG.d( LOG.d(
"Forward mail from %s to %s, mail_options %s, rcpt_options %s ", "Forward mail from %s to %s, mail_options %s, rcpt_options %s ",
contact.website_email, contact.website_email,
mailbox_email, mailbox.email,
envelope.mail_options, envelope.mail_options,
envelope.rcpt_options, envelope.rcpt_options,
) )
@ -415,7 +414,7 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
# encode message raw directly instead # encode message raw directly instead
smtp.sendmail( smtp.sendmail(
contact.reply_email, contact.reply_email,
mailbox_email, mailbox.email,
msg.as_bytes(), msg.as_bytes(),
envelope.mail_options, envelope.mail_options,
envelope.rcpt_options, envelope.rcpt_options,