code: def send_email(fromaddr, toaddr, subject, message):
      
      from smtplib import SMTP
      from email.mime.text import MIMEText
  
      SERVER = "localhost"
      _message = MIMEText(message)
      _message['Subject'] = subject
      _message['From'] = fromaddr
      _message['To'] = ", ".join(toaddr)
  
      server = SMTP(SERVER)
      server.sendmail(fromaddr, toaddr, _message.as_string())
      server.quit()
docs: Send an email message