Son NK 5 gadi atpakaļ
vecāks
revīzija
c2546cb0de
2 mainītis faili ar 8 papildinājumiem un 5 dzēšanām
  1. 2 0
      app/models.py
  2. 6 5
      email_handler.py

+ 2 - 0
app/models.py

@@ -541,3 +541,5 @@ class ForwardEmail(db.Model, ModelMixin):
     # this reply email is created every time a website sends an email to user
     # it has the prefix "reply+" to distinguish with other email
     reply_email = db.Column(db.String(128), nullable=False)
+
+    gen_email = db.relationship(GenEmail)

+ 6 - 5
email_handler.py

@@ -136,10 +136,11 @@ class MailHandler:
         return "250 Message accepted for delivery"
 
 
-controller = Controller(MailHandler(), hostname="localhost", port=20381)
+if __name__ == "__main__":
+    controller = Controller(MailHandler(), hostname="localhost", port=20381)
 
-controller.start()
-print(">>", controller.hostname, controller.port)
+    controller.start()
+    print(">>", controller.hostname, controller.port)
 
-while True:
-    time.sleep(10)
+    while True:
+        time.sleep(10)