from django.core.mail import EmailMessage from django.template.loader import render_to_string def make_stripe_email(order) -> EmailMessage: subject = 'Thanks for your sustainer payment!' email_body = render_to_string( 'supporters/mail/sustainer_thanks.txt', {'order': order}, ).strip() message = EmailMessage( subject, email_body, 'Software Freedom Conservancy ', [order.email], ) return message