I try to use python to send email, but in vain. I have already turned the list file into dataframe, then turn it into html form. However, the result show the "SyntaxError: invalid syntax" What's wrong with it?
df = pd.DataFrame(output, columns=['name', 'price', 'count', 'view'])
df.to_html('df.html')
content = MIMEMultipart()
content["subject"] = "python gmail 測試"
content["from"] = "dingyen77477449@gmail.com"
content["to"] = "dingyen77477449@gmail.com"
template = Template(file:///C:/Users/user("df.html").read_text())
content.attach(MIMEText(template, "html"))
import smtplib
with smtplib.SMTP(host="smtp.gmail.com", port="587") as smtp:
try:
smtp.ehlo()
smtp.starttls()
smtp.login("dingyen77477449", "password")
smtp.send_message(content)
print("Complete!")
except Exception as e:
print("Error message: ", e)
SyntaxError: invalid syntax