def _send_printouts_email(recipients, subject, body, html, attachment_filename): email = EmailMessage(subject=subject, body=body, to=recipients) pdf = html_to_pdf(html, stylesheet_paths=["order_printouts/css/extra.css"]) email.attach(attachment_filename, pdf, mimetype="application/pdf") email.send()