Compare commits

..

No commits in common. "59b478d8547e8bb80601ed4f8ac616c128cae46a" and "584a5e82b1512dd29ea69045fe39b9eed683a947" have entirely different histories.

View File

@ -22,11 +22,6 @@ def extract_and_convert_email(message, output_file_base, i):
try:
payload = part.get_payload(decode=True).decode(charset, errors='replace')
soup = BeautifulSoup(payload, 'html.parser')
# Nettoyage de l'HTML
attr_whitelist = ("style")
for tag in soup.findAll(True):
for attr in [attr for attr in tag.attrs if attr not in attr_whitelist]:
del tag[attr]
html_content = str(soup)
# Extraction de la date et formatage ISO
@ -43,11 +38,11 @@ def extract_and_convert_email(message, output_file_base, i):
logging.warning(f"Format de date invalide: {date_header}")
output_file = os.path.join(output_file_base, f"email_{i}") # Nom par défaut si date invalide
date_simple = "<i>date inconnue</i>"
html_header = "<div style=\"border: thick double black;\"><ul>"
html_header = "<p><ul>"
html_header += f"<li>De : {from_header}</li>"
html_header += f"<li>&#192; : {to_header}</li>"
html_header += f"<li>Date : {date_simple}</li>"
html_header += "</ul><br /></div>"
html_header += "</ul><br /></p>"
# Conversion en PDF
try:
html_content = html_header + html_content