Son NK 5 vuotta sitten
vanhempi
commit
9eb85abac4
2 muutettua tiedostoa jossa 4 lisäystä ja 19 poistoa
  1. 3 14
      email_handler.py
  2. 1 5
      tests/test_email_handler.py

+ 3 - 14
email_handler.py

@@ -7,7 +7,7 @@ Handle the email *forward* and *reply*. phase. There are 3 actors:
 This script makes sure that in the forward phase, the email that is forwarded to user personal email has the following
 This script makes sure that in the forward phase, the email that is forwarded to user personal email has the following
 envelope and header fields:
 envelope and header fields:
 Envelope:
 Envelope:
-    mail from: srs@sl.co # managed by SRS
+    mail from: @website
     rcpt to: @personal_email
     rcpt to: @personal_email
 Header:
 Header:
     From: @website
     From: @website
@@ -16,7 +16,7 @@ Header:
 
 
 And in the reply phase:
 And in the reply phase:
 Envelope:
 Envelope:
-    mail from: srs@sl.co # managed by SRS
+    mail from: @website
     rcpt to: @website
     rcpt to: @website
 
 
 Header:
 Header:
@@ -47,17 +47,6 @@ from app.utils import random_words
 from server import create_app
 from server import create_app
 
 
 
 
-def parse_srs_email(srs) -> str:
-    """
-    Parse srs0=8lgw=y6=outlook.com=abcd@mailsl.meo.ovh and return abcd@outlook.com
-    """
-    local_part = srs[: srs.find("@")]  # srs0=8lgw=y6=outlook.com=abcd
-    local_email_part = local_part[local_part.rfind("=") + 1 :]  # abcd
-
-    rest = local_part[: local_part.rfind("=")]  # srs0=8lgw=y6=outlook.com
-    domain_email_part = rest[rest.rfind("=") + 1 :]  # outlook.com
-
-    return f"{local_email_part}@{domain_email_part}"
 
 
 
 
 class MailHandler:
 class MailHandler:
@@ -108,7 +97,7 @@ class MailHandler:
             LOG.d("alias %s not exist")
             LOG.d("alias %s not exist")
             return "510 Email not exist"
             return "510 Email not exist"
 
 
-        website_email = parse_srs_email(envelope.mail_from)
+        website_email = envelope.mail_from
 
 
         forward_email = ForwardEmail.get_by(
         forward_email = ForwardEmail.get_by(
             gen_email_id=gen_email.id, website_email=website_email
             gen_email_id=gen_email.id, website_email=website_email

+ 1 - 5
tests/test_email_handler.py

@@ -1,8 +1,4 @@
-from email_handler import parse_srs_email, get_email_name
-
-
-def test_parse_srs_email():
-    assert parse_srs_email("srs0=8lgw=y6=outlook.com=abcd@sl.co") == "abcd@outlook.com"
+from email_handler import get_email_name
 
 
 
 
 def test_get_email_name():
 def test_get_email_name():