diff --git a/services/payments/src/simcore_service_payments/services/notifier_email.py b/services/payments/src/simcore_service_payments/services/notifier_email.py index 0077fccef75..d204d214d24 100644 --- a/services/payments/src/simcore_service_payments/services/notifier_email.py +++ b/services/payments/src/simcore_service_payments/services/notifier_email.py @@ -194,7 +194,14 @@ async def _create_user_email( if product.bcc_email: msg["Bcc"] = product.bcc_email - # Invoice attachment + # Body + text_template = env.get_template("notify_payments.txt") + msg.set_content(text_template.render(data)) + + html_template = env.get_template("notify_payments.html") + msg.add_alternative(html_template.render(data), subtype="html") + + # Invoice attachment (It is important that attachment is added after body) if pdf_response := await _get_invoice_pdf(payment.invoice_pdf_url): match = invoice_file_name_pattern.search( pdf_response.headers["content-disposition"] @@ -205,12 +212,6 @@ async def _create_user_email( attachment["Content-Disposition"] = f"attachment; filename={_file_name}" msg.attach(attachment) - # Body - text_template = env.get_template("notify_payments.txt") - msg.set_content(text_template.render(data)) - - html_template = env.get_template("notify_payments.html") - msg.add_alternative(html_template.render(data), subtype="html") return msg