I've got a PSCustomObject $result
which contains data that I filter through with the purpose of creating an HTML table that will be sent via Send-MailMessage
.
I can create an HTML table that looks great but I'm trying to insert this table into the body of an Outlook email, which does not seem to work with the CSS because in Outlook Word does the rendering (from what I read). If simply attaching the htm file to the email is my only option, I'll go that route but my preference is inserting the table into the email body.
$denied = @()
foreach ($a in $result) {
if ($a.MaintenanceWindow -eq 'Not found!' -or $a.LastReboot -eq 'Access Denied!') {
$denied += $a
}
} #end foreach
$a = @'
"<style>"
"BODY{background-color:lightgrey;}"
"TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
"TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
"TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
"</style>"
'@
$denied | ConvertTo-Html -Head $a | Out-File D:\c.htm;
ii D:\c.htm