text: from django.core import mail
  from django.test import TestCase
  
  
  class EmailTest(TestCase):
      def test_send_email(self):
          mail.outbox = []
          mail.send_mail(
              "Subject test",
              "Here is the message.",
              "from@example.com",
              ["to@example.com"],
              fail_silently=False,
          )
  
          # Test that one message has been sent.
          self.assertEqual(len(mail.outbox), 1)
  
          # Verify that the subject of the first message is correct.
          self.assertEqual(mail.outbox[0].subject, "Subject test")
  