code: def mail_message(smtp_server, message, from_address, rcpt_addresses):
      
      if smtp_server[0] == '/':
          # Sending the message with local sendmail
          p = os.popen(smtp_server, 'w')
          p.write(message)
          p.close()
      else:
          # Sending the message using a smtp server
          import smtplib
  
          server = smtplib.SMTP(smtp_server)
          server.sendmail(from_address, rcpt_addresses, message)
          server.quit()
docs: Send mail using smtp.