The code below sends an email to my outlook. But, the email is empty and the column names in the query are printed in subject line and the email body is empty and I don't see the query results.
import smtplib
import pyodbc
import pandas as pd
myconn = pyodbc.connect('Driver='{SQL Server}',host='', database='',user='',password='', Trusted connection='yes')
query = """SELECT *;"""
df = pd.read_sql(query, myconn)
remail = "sendto@gmail.com"
smtpObj = smtplib.SMTP('smtp-outlook.com', 587)
smtpObj.ehlo()
smtpObj.starttls()
smtpObj.login('from@gmail.com','PASSWORD')
smtpObj.sendmail('from@gmail.com', remail, 'Subject:Query results \n' +df.to_string())
smtpObj.quit()