correction on reading onet.pl emails
This commit is contained in:
@@ -71,6 +71,7 @@ class MailReader():
|
||||
messages = imap.search(['SINCE', datetime.datetime.today()])
|
||||
print("%d messages from our best friend" % len(messages))
|
||||
for uid, message_data in imap.fetch(messages, 'RFC822').items():
|
||||
try:
|
||||
email_message = email.message_from_bytes(message_data[b'RFC822'])
|
||||
from_address = email_message.get('FROM')
|
||||
subject = email_message.get('subject')
|
||||
@@ -86,6 +87,8 @@ class MailReader():
|
||||
if VALIDATION_URL_SUBJECT_fr in subject or VALIDATION_URL_SUBJECT_EN in subject:
|
||||
mail = MailPojo(subject=subject, body=body, from_address=from_address)
|
||||
mail_messages.append(mail)
|
||||
except Exception as error:
|
||||
print("error trying to read email_Message for {}".format(self.login))
|
||||
# for i in data[0].split():
|
||||
# # fetch the email message by ID
|
||||
# res, msg = imap.fetch(i, "(RFC822)")
|
||||
@@ -171,10 +174,10 @@ def need_to_check_email(mail: str, successful_items) -> bool:
|
||||
|
||||
def read_mails():
|
||||
# check time before start checking emails
|
||||
if is_time_between(time(7, 30), time(20, 30)):
|
||||
if is_time_between(time(7, 30), time(19, 30)):
|
||||
# get email address
|
||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||
# mail_address1 = MailAddress(mail="brasentuncau1973@onet.pl", password="Ex#Mhz9Fom6")
|
||||
# mail_address1 = MailAddress(mail="enasremor1973@onet.pl", password=")ozBUE0RjZ8N")
|
||||
# mail_address1 = MailAddress(mail="chenpeijun@aol.com", password="ytifuwguknzifqyb")
|
||||
# # mail_address2 = MailAddress(mail="sdfgfhgf1986@aol.com", password="fjwcgvhxxlywqfwm")
|
||||
# # mail_address3 = MailAddress(mail="ciyuexie@aol.com", password="czezlmmyypokdfce")
|
||||
|
||||
Reference in New Issue
Block a user