I followed @JayRizzo 's answer to generate emails within Python.
It worked a few weeks ago. Recently I was making another bot to do similar task. However, this time the email I received shows (No Subject: This message has no content)
I checked APP password and they should be fine.
gmail_app_password = 'abcdef1234567890'
def send_email(direct, symbol, qty, close):
  gmail_user = 'my_gmail@gmail.com'
  sent_from = gmail_user
  sent_to = ['my_hotmail@hotmail.com', 'my_hotmail@hotmail.com']
  sent_subject = (f"{symbol} {direct} alert!")
  sent_body = (f"BINANCE BOT: {direct} {qty} {symbol} at {close}"
  )
  email_text = """\
  From: %s
  To: %s
  Subject: %s
  %s
  """ % (sent_from, ", ".join(sent_to), sent_subject, sent_body)
 
  try:
      server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
      server.ehlo()
      server.login(gmail_user, gmail_app_password)
      server.sendmail(sent_from, sent_to, email_text)
      server.close()
      print('Email sent!')
  except Exception as exception:
      print("Error: %s!\n\n" % exception)
send_email('buy', 'btc', 1, 19999)
Can someone advise ? Thanks

