import sys, glob, os
sys.stdout.reconfigure(encoding="utf-8")
import extract_msg

files = glob.glob(r"\\tower\JNJEMAILS\*.msg")
f = files[0]
fname = os.path.basename(f)
print(f"Soubor: {fname}")
print("(filename = posledních 20 znaků entry_id)")
print()

m = extract_msg.Message(f)
print(f"messageId (Internet Message-ID): {m.messageId!r}")
print()

print("--- MAPI properties v souboru ---")
try:
    for pid in sorted(m.props.keys()):
        prop = m.props[pid]
        name = getattr(prop, "name", "")
        print(f"  {pid}  {name}")
except Exception as e:
    print(f"  (props nedostupné: {e})")

print()
for attr in ("entryId", "entryID", "entry_id"):
    print(f"  m.{attr} = {getattr(m, attr, '<není>')!r}")
m.close()
