diff --git a/src/email_sender.py b/src/email_sender.py index ecdbefc..514ca38 100644 --- a/src/email_sender.py +++ b/src/email_sender.py @@ -6,6 +6,7 @@ from smtplib import SMTP_SSL from argparse import ArgumentParser from datetime import date, timedelta import wikiquote +import os from event import create_events_from_span @@ -78,7 +79,9 @@ class EmailSender: def create_html_templated(events_previous, events_current, events_next): - with open('../html_template/mail.html', 'r', encoding='utf-8') as tmp: + directory = os.path.dirname(os.path.realpath(__file__)) + template_path = os.path.join(directory, '..', 'html_template', 'mail.html') + with open(template_path, 'r', encoding='utf-8') as tmp: mail = tmp.read() mail = mail.replace('{LogoAddress}', 'http://xerto.free.fr/Paturlettre/LogoLettre.png')