Since this is only used in `send_mail` and when `html_message=True`, you can move the imports there.