code: def send_email_message(self, recipient, subject, html_message, text_message, sender_email, sender_name):
          
  
          if not current_app.testing:  # pragma: no cover
              try:
                  # Prepare Sendgrid helper objects
                  from sendgrid.helpers.mail import Email, Content, Substitution, Mail
                  from_email = Email(sender_email, sender_name)
                  to_email = Email(recipient)
                  text_content = Content('text/plain', text_message)
                  html_content = Content('text/html', html_message)
                  # Prepare Sendgrid Mail object
                  # Note: RFC 1341: text must be first, followed by html
                  mail = Mail(from_email, subject, to_email, text_content)
                  mail.add_content(html_content)
                  # Send mail via the Sendgrid API
                  response = self.sg.client.mail.send.post(request_body=mail.get())
                  print(response.status_code)
                  print(response.body)
                  print(response.headers)
              except ImportError:
                  raise ConfigError(SENDGRID_IMPORT_ERROR_MESSAGE)
              except Exception as e:
                  print(e)
                  print(e.body)
                  raise
docs: Send email message via sendgrid-python.
  
          Args:
              recipient: Email address or tuple of (Name, Email-address).
              subject: Subject line.
              html_message: The message body in HTML.
              text_message: The message body in plain text.