mirror of
https://github.com/draga79/NotiMail.git
synced 2024-11-09 23:51:07 +01:00
Fixed output
This commit is contained in:
parent
d10ab7a20e
commit
636044ab52
1 changed files with 6 additions and 6 deletions
12
NotiMail.py
12
NotiMail.py
|
@ -287,7 +287,7 @@ class IMAPHandler:
|
||||||
self.mail.select('inbox')
|
self.mail.select('inbox')
|
||||||
except imaplib.IMAP4.error as e:
|
except imaplib.IMAP4.error as e:
|
||||||
print(f"Cannot connect: {str(e)}")
|
print(f"Cannot connect: {str(e)}")
|
||||||
notifier.send_notification("Script Error", f"[{self.email_user}] Cannot connect: {str(e)}")
|
notifier.send_notification("Script Error", f"Cannot connect: {str(e)}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def idle(self):
|
def idle(self):
|
||||||
|
@ -302,7 +302,7 @@ class IMAPHandler:
|
||||||
if line:
|
if line:
|
||||||
print(line.decode('utf-8'))
|
print(line.decode('utf-8'))
|
||||||
if b'BYE' in line:
|
if b'BYE' in line:
|
||||||
raise ConnectionAbortedError("[{self.email_user}] Received BYE from server. Trying to reconnect...")
|
raise ConnectionAbortedError("Received BYE from server. Trying to reconnect...")
|
||||||
if b'EXISTS' in line:
|
if b'EXISTS' in line:
|
||||||
break
|
break
|
||||||
self.mail.send(b'DONE\r\n')
|
self.mail.send(b'DONE\r\n')
|
||||||
|
@ -310,16 +310,16 @@ class IMAPHandler:
|
||||||
except imaplib.IMAP4.abort as e:
|
except imaplib.IMAP4.abort as e:
|
||||||
print(f"Connection closed by server: {str(e)}")
|
print(f"Connection closed by server: {str(e)}")
|
||||||
logging.error(f"[{self.email_user}] Connection closed by server: {str(e)}")
|
logging.error(f"[{self.email_user}] Connection closed by server: {str(e)}")
|
||||||
notifier.send_notification("Script Error", f"[{self.email_user}] Connection closed by server: {str(e)}")
|
notifier.send_notification("Script Error", f"Connection closed by server: {str(e)}")
|
||||||
raise ConnectionAbortedError("[{self.email_user}] Connection lost. Trying to reconnect...")
|
raise ConnectionAbortedError("Connection lost. Trying to reconnect...")
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
print("Socket timeout during IDLE, re-establishing connection...")
|
print("Socket timeout during IDLE, re-establishing connection...")
|
||||||
logging.info(f"[{self.email_user}] Socket timeout during IDLE, re-establishing connection...")
|
logging.info(f"[{self.email_user}] Socket timeout during IDLE, re-establishing connection...")
|
||||||
raise ConnectionAbortedError("[{self.email_user}] Socket timeout. Trying to reconnect...")
|
raise ConnectionAbortedError("Socket timeout. Trying to reconnect...")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An error occurred: {str(e)}")
|
print(f"An error occurred: {str(e)}")
|
||||||
logging.info(f"[{self.email_user}] An error occurred: {str(e)}")
|
logging.info(f"[{self.email_user}] An error occurred: {str(e)}")
|
||||||
notifier.send_notification("Script Error", f"[{self.email_user}] An error occurred: {str(e)}")
|
notifier.send_notification("Script Error", f"An error occurred: {str(e)}")
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
print("IDLE mode stopped.")
|
print("IDLE mode stopped.")
|
||||||
|
|
Loading…
Reference in a new issue