mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 07:43:54 +08:00
take into account mailbox in forward phase
This commit is contained in:
parent
fc167b8b41
commit
7407f678ce
2 changed files with 8 additions and 3 deletions
|
@ -199,7 +199,10 @@ class MailHandler:
|
|||
LOG.d("alias %s cannot be created on-the-fly, return 510", alias)
|
||||
return "510 Email not exist"
|
||||
|
||||
user_email = gen_email.user.email
|
||||
if gen_email.mailbox_id:
|
||||
mailbox_email = gen_email.mailbox.email
|
||||
else:
|
||||
mailbox_email = gen_email.user.email
|
||||
|
||||
website_email = get_email_part(msg["From"])
|
||||
|
||||
|
@ -267,7 +270,7 @@ class MailHandler:
|
|||
LOG.d(
|
||||
"Forward mail from %s to %s, mail_options %s, rcpt_options %s ",
|
||||
website_email,
|
||||
user_email,
|
||||
mailbox_email,
|
||||
envelope.mail_options,
|
||||
envelope.rcpt_options,
|
||||
)
|
||||
|
@ -277,7 +280,7 @@ class MailHandler:
|
|||
msg_raw = msg.as_string().encode()
|
||||
smtp.sendmail(
|
||||
forward_email.reply_email,
|
||||
user_email,
|
||||
mailbox_email,
|
||||
msg_raw,
|
||||
envelope.mail_options,
|
||||
envelope.rcpt_options,
|
||||
|
|
|
@ -48,6 +48,7 @@ from app.models import (
|
|||
CustomDomain,
|
||||
LifetimeCoupon,
|
||||
Directory,
|
||||
Mailbox,
|
||||
)
|
||||
from app.monitor.base import monitor_bp
|
||||
from app.oauth.base import oauth_bp
|
||||
|
@ -179,6 +180,7 @@ def fake_data():
|
|||
client2.published = True
|
||||
db.session.commit()
|
||||
|
||||
Mailbox.create(user_id=user.id, email="ab@cd.ef", verified=True)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue