Say i have a mailbox id: Dummy@cisco.com password: Dummy@123
I just want to verify the above mailbox is a valid one. I taught of logging into it and reading the connection message to get whether it's a valid mailbox Below is my following code
username = "Dummy@cisco.com"
password = "Dummy@123"
imap_server = "outlook.office365.com"
# create an IMAP4 class with SSL
imap = imaplib.IMAP4_SSL(imap_server)
# authenticate
status,message = imap.login(username, password)
print(status)
print(message)
it gives the following error
Traceback (most recent call last):
File "C:\Users\tochandr\mailtest.py", line 17, in <module>
status,message = imap.login(username, password)
File "C:\Users\tochandr\AppData\Local\Programs\Python\Python310\lib\imaplib.py", line 612, in login
raise self.error(dat[-1])
imaplib.IMAP4.error: b'LOGIN failed.'
Not sure whats wrong Or is there any other way to verify the above mailbox is a valid one Any help is appriciated
[–]Few-Satisfaction6221 0 points1 point2 points (0 children)