#!/usr/bin/env python3
import sys
import email.policy

msg = email.message_from_file(sys.stdin, policy=email.policy.default)
for part in msg.walk():
    if part.get_content_maintype() == 'image':
        part.clear_content()
        part.set_content("""\
Salut!

The image attachment is removed.

--Pepé
""")

print(msg)