I want to replace the built-in send_mail function , which only works with text email messages, with my own intelligent send_mail function , which generates as html, text versions automatically. Everything works as expected for my own emails defined in my own application. I can do this in views.py this way:
from django.core import mail
from utils import send_mail as send_html_mail
mail.send_mail = send_html_mail
But the problem still appears with third-party messaging applications. There, all the imports have already been completed before my code by decapitating the send_mail function .
Is it possible to override this function before importing all django applications? Or there may be another solution to this problem. I really do not want to fix the code with sending emails from these third-party applications. It's easy to just put the html template.
source
share