I've successfully created a template used by sendgrid to send an html formatted email to customer service at the end of an AI conversation. I discovered that when viewed in outlook the style elements were not being applied as expected (does not look the same in outlook as in a webmail client like gmail).
I tried to transform the html output to a pdf document, hoping the look and feel issues would be resolved with a true representation of the html, but it was not. SendGrid only supports inline css and there are several further restrictions on what you can do with html, so I used tables to handle positioning. Unfortunately the H4 heading I inserted in the table, while looking fine in webmail, does not carry background colour into the pdf.
// ******************** reportNice ******************* //
String reportNice = "<div style='padding:10px; margin:1px; color:white; font-family:Calibri, sans-serif; background-color:#305496;border-radius:8px;'><h2>Automated Triage Response - ID: " + caseID + "</h2>";
// ******************** reportedBy ******************* //
reportNice = reportNice + "<h3>Summary:</h3> <table style='color:#565867; background-color:rgb(237,237,237);border-radius:10px;width:99%;'> <tr><td style='vertical-align:top; border-right:white solid thin;padding-right:10px;margin-right:10px;'><h4 style='background-color:rgba(48,84,150,.7);border:1px solid #ddd;color:#fff;padding-left:10px;border-radius:10px;'>Reporter Details</h4>";
// ******************** reportedBy ********************* //
String reportedBy = "<p>Reported by: [ " + howKnown + " ]";
if(howKnown!="anonymous") {
reportedBy = reportedBy + Lib_sUserFirstName + " " + Lib_sUserSurname;
}
reportedBy = reportedBy + "</p>";
reportedBy = reportedBy + "<ul><li>Contact email: <b style='color:black;'>";
if(email!="") {
reportedBy = reportedBy + email + "</b></li>";
}
if(phone!="") {
reportedBy = reportedBy + "<li>Contact phone: <b style='color:black;'>" + phone + "</b></li>";
}
if(commMethod!="") {
reportedBy = reportedBy + "<li>Preferred contact method: <b style='color:black;'>" + commMethod + "</b></li>";
}
reportedBy = reportedBy + "</ul></td>";
...
SendGrid transforms the user response to html and it looks fine, but when the html is transformed to pdf the background-color on the h4 is lost:
<h4 style='background-color:rgba(48,84,150,.7);border:1px solid #ddd;color:#fff;padding-left:10px;border-radius:10px;'>
If anyone here has experience with Teneo, Java, HTML, PDF, SendGrid and has made it work I would appreciate some ponters.