40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import imaplib
|
|
import ssl
|
|
|
|
def test_login():
|
|
try:
|
|
print("Connecting to IMAP server...")
|
|
context = ssl.create_default_context()
|
|
context.check_hostname = False
|
|
context.verify_mode = ssl.CERT_NONE
|
|
|
|
mail = imaplib.IMAP4_SSL('localhost', 9930, ssl_context=context)
|
|
print("Connected!")
|
|
|
|
# Enable debug to see what's happening
|
|
mail.debug = 4
|
|
|
|
print("Attempting login...")
|
|
result = mail.login('tanya@jongsma.me', 'Tanya-Migrate-2026!')
|
|
print(f"Login successful: {result}")
|
|
|
|
# Test listing folders
|
|
print("Listing folders...")
|
|
status, folders = mail.list()
|
|
print(f"List result: {status}")
|
|
for folder in folders[:5]: # Just first 5
|
|
print(f" {folder}")
|
|
|
|
mail.logout()
|
|
print("Test complete!")
|
|
|
|
except imaplib.IMAP4.error as e:
|
|
print(f"IMAP error: {e}")
|
|
except Exception as e:
|
|
print(f"General error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
test_login() |