You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
685 B
24 lines
685 B
2 years ago
|
# import the modules
|
||
|
import imaplib
|
||
|
import email
|
||
|
from email.header import decode_header
|
||
|
import webbrowser
|
||
|
import os
|
||
|
from dotenv import load_dotenv
|
||
|
import time
|
||
|
# load env file
|
||
|
load_dotenv()
|
||
|
pw = os.getenv('PASSWORD')
|
||
|
server ="w00e1ce2.kasserver.com"
|
||
|
username ="booking@sommerschein.de"
|
||
|
|
||
|
# Connect to inbox
|
||
|
imap_server = imaplib.IMAP4_SSL(host=server)
|
||
|
imap_server.login(username, pw)
|
||
|
imap_server.select() # Default is `INBOX`
|
||
|
|
||
|
# Find all emails in inbox and print out the raw email data
|
||
|
_, message_numbers_raw = imap_server.search(None, 'ALL')
|
||
|
for message_number in message_numbers_raw[0].split():
|
||
|
_, msg = imap_server.fetch(message_number, '(RFC822)')
|
||
|
print(msg[0][1])
|