string emailHTML = "<html><head><style>table {border: 1px solid black; font-family: Arial, Helvetica, sans-serif;}"
+ "td, th {padding: 0.1cm 0.5cm; }tr:nth-child(even) {background-color: #dddddd;}"
+ "</style></head><body><table><tr><th colspan='2'>CONTACTS</th><th colspan='2'>OPPORTUNITIES</th></tr>"
+ "<tr><td>Newly created records total</td><td>" + totalNewRecords + "</td><td>Newly created records total</td><td>" + sumTotalOfImportedOppRecords + "</td></tr>"
+ "<tr><td colspan='2' align='center'><b>Totals for Contact records not imported</b></td>"
+ "<td colspan='2' align='center'><b>Totals for Opportunity records not imported</b></td></td></tr>"
+ "<tr><td>Do not contact</td><td>" + totalNotImported_DoNotContact + "</td><td>Existing Opportunities</td><td>" + totalNonImportedOpps + "</td></tr>"
+ "<tr><td>Ref Match</td><td>" + totalRefMatch + "</td><td>Error records</td><td>" + totalNonImportedErrorOpps + "</td></tr>"
+ " <tr><td>Other Match</td><td>" + totalRefNonMatch + "</td><td colspan='2' align='center'><b>Totals for Opportunity records imported</b></td></tr>"
+ "<tr><td>Contacts with no Opportunities</td><td>" + totalContactsNotImported_NoOpps + "</td><td>Total Opportunities imported</td><td>" + totalNewlyImportedOpps + "</td></tr>"
+ "<tr><td>Error records</td><td>" + totalNotImportedErrorRecords + "</td><td>Total Non Opportunities imported</td><td>" + totalNewlyImportedNonOpps + "</td></tr> "
+ "<tr><td>Total Contacts in file</td><td>" + sumTotalOfContactRecords
+ "</td><td>Total Opportunities in file</td><td>" + sumTotalOfOppRecords + "</td></tr>"
+ "<tr><td>Total Contacts imported</td><td>" + totalNewRecords + "</td><td>Total Opportunities imported</td><td>" + sumTotalOfImportedOppRecords + "</td></tr>"
+ "<tr><td>Total Contacts not imported</td><td>" + TotalContactsNotImported + "</td><td>Total Opportunities not imported</td><td>" + TotalOpportunitiesNotImported + "</td></tr>"
+ "</table></body></html>";
body.AppendLine(emailHTML);
I'm trying to send a CRM HTML email from within a C# console app. I need to have some variables in the HTML. It's working fine, but I'm hard coding the HTML in the code. I think there's a different/better way to do this?
*This post is locked for comments
I have the same question (0)