mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
allow user sends emails to his alias from his mailbox
This commit is contained in:
parent
f59ccd4018
commit
b5e7f05bfc
1 changed files with 0 additions and 16 deletions
|
@ -93,9 +93,6 @@ from app.utils import random_string
|
||||||
from init_app import load_pgp_public_keys
|
from init_app import load_pgp_public_keys
|
||||||
from server import create_app
|
from server import create_app
|
||||||
|
|
||||||
# used when an alias receives email from its own mailbox
|
|
||||||
# can happen when user "Reply All" on some email clients
|
|
||||||
_SELF_FORWARDING_STATUS = "550 SL self-forward"
|
|
||||||
|
|
||||||
_IP_HEADER = "X-SimpleLogin-Client-IP"
|
_IP_HEADER = "X-SimpleLogin-Client-IP"
|
||||||
|
|
||||||
|
@ -331,13 +328,6 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
|
||||||
mailbox_email = mailbox.email
|
mailbox_email = mailbox.email
|
||||||
user = alias.user
|
user = alias.user
|
||||||
|
|
||||||
# Sometimes when user clicks on "reply all"
|
|
||||||
# an email is sent to the same alias that the previous message is destined to
|
|
||||||
if envelope.mail_from == mailbox_email:
|
|
||||||
# nothing to do
|
|
||||||
LOG.d("Forward from %s to %s, nothing to do", envelope.mail_from, mailbox_email)
|
|
||||||
return False, _SELF_FORWARDING_STATUS
|
|
||||||
|
|
||||||
contact = get_or_create_contact(msg["From"], alias)
|
contact = get_or_create_contact(msg["From"], alias)
|
||||||
email_log = EmailLog.create(contact_id=contact.id, user_id=contact.user_id)
|
email_log = EmailLog.create(contact_id=contact.id, user_id=contact.user_id)
|
||||||
|
|
||||||
|
@ -940,12 +930,6 @@ def handle(envelope: Envelope, smtp: SMTP) -> str:
|
||||||
is_delivered, smtp_status = handle_forward(envelope, smtp, msg, rcpt_to)
|
is_delivered, smtp_status = handle_forward(envelope, smtp, msg, rcpt_to)
|
||||||
res.append((is_delivered, smtp_status))
|
res.append((is_delivered, smtp_status))
|
||||||
|
|
||||||
# special handling for self-forwarding
|
|
||||||
# just consider success delivery in this case
|
|
||||||
if len(res) == 1 and res[0][1] == _SELF_FORWARDING_STATUS:
|
|
||||||
LOG.d("Self-forwarding, ignore")
|
|
||||||
return "250 SL OK"
|
|
||||||
|
|
||||||
for (is_success, smtp_status) in res:
|
for (is_success, smtp_status) in res:
|
||||||
# Consider all deliveries successful if 1 delivery is successful
|
# Consider all deliveries successful if 1 delivery is successful
|
||||||
if is_success:
|
if is_success:
|
||||||
|
|
Loading…
Reference in a new issue