Converting to python3
Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
parent
ce7fa554bf
commit
8c01a68245
17
check_imap_login.py
Normal file → Executable file
17
check_imap_login.py
Normal file → Executable file
|
@ -15,10 +15,10 @@
|
|||
import sys, os, imaplib, getopt
|
||||
|
||||
def usage():
|
||||
print "-u <user>"
|
||||
print "-p <password>"
|
||||
print "-s use SSL"
|
||||
print "-H <host>"
|
||||
print("-u <user>")
|
||||
print("-p <password>")
|
||||
print("-s use SSL")
|
||||
print("-H <host>")
|
||||
|
||||
def main():
|
||||
try:
|
||||
|
@ -49,16 +49,13 @@ def main():
|
|||
|
||||
try:
|
||||
M.login(user, password)
|
||||
except Exception, e:
|
||||
print "CRITICAL: IMAP Login not Successful: %s" % e
|
||||
except Exception as e:
|
||||
print(f"CRITICAL: IMAP Login not Successful: {e}")
|
||||
sys.exit(2)
|
||||
|
||||
M.logout()
|
||||
print "OK IMAP Login Successful"
|
||||
print("OK IMAP Login Successful")
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue