I am trying to fetch mail from a email account, I cannot login when I have password with special characters.
import imaplib
username = 'test@test.com'
password = "test!002"
imap_server = 'imap.test.com'
mail = imaplib.IMAP4_SSL(imap_server)
mail.login(username, password)
Output:
[AUTHENTICATIONFAILED] Invalid credentials(Failure)' Exception in connectionb'[AUTHENTICATIONFAILED] Invalid credentials(Failure)
The same code works if I change the password which does not special Characters. Can any one tell me how to login to imap with passwords containing special characters.