mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
16 lines
379 B
Python
16 lines
379 B
Python
import imaplib, os
|
|
|
|
username = "testuser@" + os.environ.get("DOMAIN", "testdomain.com")
|
|
|
|
M = imaplib.IMAP4_SSL(os.environ["INSTANCE_IP"])
|
|
M.login(username, "testpw")
|
|
M.select()
|
|
print("Login successful.")
|
|
typ, data = M.search(None, 'ALL')
|
|
for num in data[0].split():
|
|
typ, data = M.fetch(num, '(RFC822)')
|
|
print('Message %s\n%s\n' % (num, data[0][1]))
|
|
M.close()
|
|
M.logout()
|
|
|