I'm working on an app that sends out emails. I would like to be able to embed a custom generated table into the email body. However, it is rendered as text instead of parsed as html and displayed accordingly. I am using HTML.py to create a table using a list, and emailing it. Any ideas whats going on? I'm using requests to send the email, so SMTP and mailers wont be of much help to me.
<TABLE cellpadding="4" style="border: 1px solid #000000; border-collapse: collapse;" border="1">
<TR>
<TD>Apple (Ammre)</TD>
<TD>53.0</TD>
<TD>55.0</TD>
</TR>
</TABLE>
This is the table generated by HTML.py. I append the <html>
tag around it. But to no avail. Any advice would be much appreciated.
This is how I'm generating the HTML from python.
for fruit in fruits:
fruitPrices.append([fruit.name, fruit.price_min, fruit.price_max])
htmlcode = "<HTML>" + HTML.table(fruitPrices) + "</HTML>"
print htmlcode
and sending like this
requests.post(
"URL HERE",
auth=("api", "MY KEY HERE"),
data={"from": "MY EMAIL ADDRESS HERE",
"to": email,
"subject": subject,
"text": message
})