import email
from email import policy
import sys

def read_eml(file_path):
    with open(file_path, 'rb') as f:
        msg = email.message_from_binary_file(f, policy=policy.default)
    
    print(f"=== {file_path} ===")
    print("Subject:", msg['subject'])
    
    body = msg.get_body(preferencelist=('plain', 'html'))
    if body:
        text = body.get_content()
        # limit to 2000 chars to avoid huge outputs
        print(text[:4000])
    else:
        print("No text body found.")
    print("\n" + "="*40 + "\n")

read_eml("chef kamil yazı ve görseller.eml")
read_eml("tostum ön söz ve yazıları.eml")
