mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +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)
|
LOG.d("alias %s cannot be created on-the-fly, return 510", alias)
|
||||||
return "510 Email not exist"
|
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"])
|
website_email = get_email_part(msg["From"])
|
||||||
|
|
||||||
|
@ -267,7 +270,7 @@ class MailHandler:
|
||||||
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 ",
|
||||||
website_email,
|
website_email,
|
||||||
user_email,
|
mailbox_email,
|
||||||
envelope.mail_options,
|
envelope.mail_options,
|
||||||
envelope.rcpt_options,
|
envelope.rcpt_options,
|
||||||
)
|
)
|
||||||
|
@ -277,7 +280,7 @@ class MailHandler:
|
||||||
msg_raw = msg.as_string().encode()
|
msg_raw = msg.as_string().encode()
|
||||||
smtp.sendmail(
|
smtp.sendmail(
|
||||||
forward_email.reply_email,
|
forward_email.reply_email,
|
||||||
user_email,
|
mailbox_email,
|
||||||
msg_raw,
|
msg_raw,
|
||||||
envelope.mail_options,
|
envelope.mail_options,
|
||||||
envelope.rcpt_options,
|
envelope.rcpt_options,
|
||||||
|
|
|
@ -48,6 +48,7 @@ from app.models import (
|
||||||
CustomDomain,
|
CustomDomain,
|
||||||
LifetimeCoupon,
|
LifetimeCoupon,
|
||||||
Directory,
|
Directory,
|
||||||
|
Mailbox,
|
||||||
)
|
)
|
||||||
from app.monitor.base import monitor_bp
|
from app.monitor.base import monitor_bp
|
||||||
from app.oauth.base import oauth_bp
|
from app.oauth.base import oauth_bp
|
||||||
|
@ -179,6 +180,7 @@ def fake_data():
|
||||||
client2.published = True
|
client2.published = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
Mailbox.create(user_id=user.id, email="ab@cd.ef", verified=True)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue