My project is coming along nicely!
I now have my SMS Log working fairly well, and I've built the blueprint for the actual chat bot. Next up, I'd like to figure out how to send an email with the log and clear all entries from that number at the end of a conversation.
I've figured out how to send the email using send_email(message)
where message
is any text I want to assign. I can also assign all items in each database row to a variable, and to clear the table. I haven't yet, but I'm pretty sure I can clear just the matching rows in the table. What I CAN'T figure out is how to send an email that intelligently parses those variables into an html format.
Apparently render_template is designed to render output for flask, because trying that popped up a bunch of error codes I didn't fully understand. I'd like to do something like:
message = render_template("email_template.html", smsLog = filtered_SMS_log)
send_email(message)
where the email template filters through the rows in the log. I feel like I won't get away with it, but I'd like to avoid having to install new stuff into my virtualenv if possible (but, obviously, if it's the only way...). Topics on this online are scattered and I'm not sure where to go.
How do I do this?