From ee4d3565061c27f522e16fc7d74ef391299289b5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 12:40:57 +0100 Subject: [PATCH] initial commit --- prototyping/email_stuff.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 prototyping/email_stuff.py diff --git a/prototyping/email_stuff.py b/prototyping/email_stuff.py new file mode 100644 index 0000000..dfbabe0 --- /dev/null +++ b/prototyping/email_stuff.py @@ -0,0 +1,33 @@ +# %% + +import base64 +import email +import imaplib + +# %% +import json +from imaplib import IMAP4, IMAP4_SSL +from pathlib import Path + +# -------------------------------- credentials ------------------------------- # + +cred_file = Path("../credentials.json") +with open(cred_file, "r") as f: + CREDENTIALS = json.load(f) + +username = CREDENTIALS["imap_user"] +password = CREDENTIALS["imap_pass"] + + +# ----------------------------------- imap ----------------------------------- # + +host = "mail.local-it.org" +imap_port = 143 +imap_ssl_port = 993 + + +# with IMAP4("domain.org") as M: +# M.noop() + +with IMAP4_SSL(host=host) as M: + M.noop()