Merge branch 'master' of bitbucket.org:panleicim/appointment_tool
This commit is contained in:
@@ -78,7 +78,7 @@ class MailConfirmationReader():
|
|||||||
body = body + str(part.get_payload(decode=True).decode("utf-8"))
|
body = body + str(part.get_payload(decode=True).decode("utf-8"))
|
||||||
elif part.get_content_type() == "text/plain":
|
elif part.get_content_type() == "text/plain":
|
||||||
body = body + part.get_payload()
|
body = body + part.get_payload()
|
||||||
if CONFIRMATION_SUBJECT_FR in subject or CONFIRMATION_SUBJECT_EN in subject:
|
if CONFIRMATION_SUBJECT_FR in subject or CONFIRMATION_SUBJECT_EN in subject or "Votre_rendez-vous_est_confirm" in subject:
|
||||||
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
||||||
mail.isImapClient = True
|
mail.isImapClient = True
|
||||||
print("subject is {}".format(subject))
|
print("subject is {}".format(subject))
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ DOMAIN_GMX_FR = "gmx.fr"
|
|||||||
DOMAIN_GMX_US = "gmx.us"
|
DOMAIN_GMX_US = "gmx.us"
|
||||||
DOMAIN_GMX_CH = "gmx.ch"
|
DOMAIN_GMX_CH = "gmx.ch"
|
||||||
DOMAIN_ONET = "onet.pl"
|
DOMAIN_ONET = "onet.pl"
|
||||||
|
DOMAIN_GAZETA_PL = "gazeta.pl"
|
||||||
DOMAIN_NAVER = "naver.com"
|
DOMAIN_NAVER = "naver.com"
|
||||||
DOMAIN_INBOX_LV = "inbox.lv"
|
DOMAIN_INBOX_LV = "inbox.lv"
|
||||||
DOMAIN_GMX_DE = "gmx.de"
|
DOMAIN_GMX_DE = "gmx.de"
|
||||||
@@ -33,6 +34,7 @@ DOMAIN_GENOCIDE_FUN = "genocide.fun"
|
|||||||
DOMAIN_DMC_CHAT = "dmc.chat"
|
DOMAIN_DMC_CHAT = "dmc.chat"
|
||||||
DOMAIN_WEB_DE = "web.de"
|
DOMAIN_WEB_DE = "web.de"
|
||||||
DOMAIN_OUTLOOK_COM = "outlook.com"
|
DOMAIN_OUTLOOK_COM = "outlook.com"
|
||||||
|
DOMAIN_FIREMAIL_DE = "firemail.de"
|
||||||
|
|
||||||
AOL_IMAP_SERVER = "imap.aol.com"
|
AOL_IMAP_SERVER = "imap.aol.com"
|
||||||
IMAP_SERVER_163 = "imap.163.com"
|
IMAP_SERVER_163 = "imap.163.com"
|
||||||
@@ -51,9 +53,11 @@ SERVER_IMAGE_ONET = "imap.poczta.onet.pl"
|
|||||||
SERVER_GMX = "imap.gmx.com"
|
SERVER_GMX = "imap.gmx.com"
|
||||||
SERVER_GMX_NET = "imap.gmx.net"
|
SERVER_GMX_NET = "imap.gmx.net"
|
||||||
SERVER_GMX_AT = "imap.gmx.at"
|
SERVER_GMX_AT = "imap.gmx.at"
|
||||||
|
SERVER_FIREMAIL_DE = "imap.firemail.de"
|
||||||
SERVER_PISS_MAIL = "mail.pissmail.com"
|
SERVER_PISS_MAIL = "mail.pissmail.com"
|
||||||
INBOX_LV = "mail.inbox.lv"
|
INBOX_LV = "mail.inbox.lv"
|
||||||
SERVER_WEB_DE = "imap.web.de"
|
SERVER_WEB_DE = "imap.web.de"
|
||||||
|
IMAP_SERVER_DOMAIN_GAZETA_PL = "imap.gazeta.pl"
|
||||||
|
|
||||||
|
|
||||||
def show_folders(imap) -> list:
|
def show_folders(imap) -> list:
|
||||||
@@ -81,6 +85,8 @@ def create_imap(login: str):
|
|||||||
imap = IMAPClient(IMAP_SERVER_163, use_uid=True)
|
imap = IMAPClient(IMAP_SERVER_163, use_uid=True)
|
||||||
elif DOMAIN_YAHOO in login:
|
elif DOMAIN_YAHOO in login:
|
||||||
imap = imaplib.IMAP4_SSL(YAHOO_IMAP_SERVER)
|
imap = imaplib.IMAP4_SSL(YAHOO_IMAP_SERVER)
|
||||||
|
elif DOMAIN_FIREMAIL_DE in login:
|
||||||
|
imap = imaplib.IMAP4_SSL(SERVER_FIREMAIL_DE)
|
||||||
elif DOMAIN_GMX in login or DOMAIN_GMX_FR in login or DOMAIN_GMX_US in login or DOMAIN_GMX_CH in login:
|
elif DOMAIN_GMX in login or DOMAIN_GMX_FR in login or DOMAIN_GMX_US in login or DOMAIN_GMX_CH in login:
|
||||||
imap = imaplib.IMAP4_SSL(SERVER_GMX)
|
imap = imaplib.IMAP4_SSL(SERVER_GMX)
|
||||||
elif DOMAIN_SINA in login:
|
elif DOMAIN_SINA in login:
|
||||||
@@ -110,6 +116,8 @@ def create_imap(login: str):
|
|||||||
imap = imaplib.IMAP4_SSL(SERVER_GMX_NET, port=993)
|
imap = imaplib.IMAP4_SSL(SERVER_GMX_NET, port=993)
|
||||||
elif DOMAIN_GMX_AT in login:
|
elif DOMAIN_GMX_AT in login:
|
||||||
imap = imaplib.IMAP4_SSL(SERVER_GMX_AT, port=993)
|
imap = imaplib.IMAP4_SSL(SERVER_GMX_AT, port=993)
|
||||||
|
elif DOMAIN_GAZETA_PL in login:
|
||||||
|
imap = imaplib.IMAP4_SSL(IMAP_SERVER_DOMAIN_GAZETA_PL, port=993)
|
||||||
elif DOMAIN_INBOX_LV in login:
|
elif DOMAIN_INBOX_LV in login:
|
||||||
imap = imaplib.IMAP4_SSL(INBOX_LV, port=993)
|
imap = imaplib.IMAP4_SSL(INBOX_LV, port=993)
|
||||||
elif DOMAIN_WEB_DE in login:
|
elif DOMAIN_WEB_DE in login:
|
||||||
|
|||||||
@@ -167,12 +167,14 @@ class MailReader():
|
|||||||
body = body + part.get_payload(decode=True).decode("utf-8")
|
body = body + part.get_payload(decode=True).decode("utf-8")
|
||||||
elif part.get_content_type() == "text/plain":
|
elif part.get_content_type() == "text/plain":
|
||||||
body = body + part.get_payload()
|
body = body + part.get_payload()
|
||||||
if VALIDATION_URL_SUBJECT_fr in subject or VALIDATION_URL_SUBJECT_EN in subject:
|
if VALIDATION_URL_SUBJECT_fr in subject or VALIDATION_URL_SUBJECT_EN in subject or "Validation=20de=20votre=20demande=20de=20rendez-vous" in subject:
|
||||||
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
||||||
mail.isImapClient = True
|
mail.isImapClient = True
|
||||||
print("email is {}".format(self.login))
|
print("email is {}".format(self.login))
|
||||||
print("body is {}".format(body))
|
print("body is {}".format(body))
|
||||||
print("subject is {}".format(subject))
|
print("subject is {}".format(subject))
|
||||||
|
if len(mail.to_address) == 0:
|
||||||
|
mail.to_address = self.login
|
||||||
mail_messages.append(mail)
|
mail_messages.append(mail)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(error)
|
print(error)
|
||||||
@@ -242,7 +244,7 @@ def read_mails():
|
|||||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||||
# excel_reader = ExcelHelper()
|
# excel_reader = ExcelHelper()
|
||||||
# mail_list = excel_reader.read_email_pojo(file_name="/Users/panlei/Downloads/hotmail_list.xlsx")
|
# mail_list = excel_reader.read_email_pojo(file_name="/Users/panlei/Downloads/hotmail_list.xlsx")
|
||||||
# mail_address1 = MailAddress(mail="quaveraidv@hotmail.com", password="2iB60x20")
|
# mail_address1 = MailAddress(mail="casandrakaamv@onet.pl", password="8F0o0APeAp0z")
|
||||||
# mail_list = [mail_address1]
|
# mail_list = [mail_address1]
|
||||||
successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
|
successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
|
||||||
mails_messages = []
|
mails_messages = []
|
||||||
|
|||||||
@@ -186,12 +186,14 @@ class MailReader():
|
|||||||
body = body + part.get_payload(decode=True).decode("utf-8")
|
body = body + part.get_payload(decode=True).decode("utf-8")
|
||||||
elif part.get_content_type() == "text/plain":
|
elif part.get_content_type() == "text/plain":
|
||||||
body = body + part.get_payload()
|
body = body + part.get_payload()
|
||||||
if VALIDATION_URL_SUBJECT_fr in subject or VALIDATION_URL_SUBJECT_EN in subject:
|
if VALIDATION_URL_SUBJECT_fr in subject or VALIDATION_URL_SUBJECT_EN in subject or "Validation=20de=20votre=20demande=20de=20rendez-vous" in subject:
|
||||||
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
||||||
mail.isImapClient = True
|
mail.isImapClient = True
|
||||||
print("email is {}".format(self.login))
|
print("email is {}".format(self.login))
|
||||||
print("body is {}".format(body))
|
print("body is {}".format(body))
|
||||||
print("subject is {}".format(subject))
|
print("subject is {}".format(subject))
|
||||||
|
if len(mail.to_address) == 0:
|
||||||
|
mail.to_address = self.login
|
||||||
mail_messages.append(mail)
|
mail_messages.append(mail)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(error)
|
print(error)
|
||||||
|
|||||||
Reference in New Issue
Block a user