ronisbr/PrettyTables.jl

Support for HTML Emails

baumgold opened this issue · 1 comments

Thank you for putting together this package. I'm trying to send a nicely formatted table (e.g. border, colors) via HTML Email. Unfortunately it appears that some email providers (e.g. Gmail) do not support proper CSS. The suggestions that I've gathered from Google seem to be to either use inline styles, or raw HTML without any CSS. I haven't found a way to do either with this package or any other Julia package. Any suggestions? Here's an example of what I'm trying to do. Thanks.

using DataFrames, PrettyTables, SMTPClient
df = DataFrame(A=1:4, B=["A", "B", "C", "D"])
table = pretty_table(HTML, df)
emailfrom = "someone@somewhere.com"
emailto = [emailfrom]
subject = "Test123"
body = get_body(emailto, emailfrom, subject, get_mime_msg(table))
opt = SendOptions(; username=emailfrom)
send("smtp.google.com", emailto, emailfrom, body, opt)

It actually looks like the problem is that Gmail ignores the CSS because it's not enclosed in a head block. #199 to fix the bug.