lan2022nguyen
New Coder
I have a powershell script that sends mail as html. This is based on the result of SQL query which checks the database status (online or offline) and if it has any failed jobs for each projects (A,B,C).
$group1, $group2, $group5 = ‘ONLINE’ or ‘OFFLINE’
$group3, $group4, $group7 = List of failed jobs or ‘No Failed Job’
Here’s my request: if $group3, $group4, $group7 = ‘No Failed Job’, make the color font ‘No Failed Job’ red. Otherwise, normal default color.
$group1, $group2, $group5 = ‘ONLINE’ or ‘OFFLINE’
$group3, $group4, $group7 = List of failed jobs or ‘No Failed Job’
Here’s my request: if $group3, $group4, $group7 = ‘No Failed Job’, make the color font ‘No Failed Job’ red. Otherwise, normal default color.
HTML:
$body = "<HTML><HEAD><META http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"" /><TITLE></TITLE></HEAD>"
$body += "<BODY bgcolor=""#FFFFFF"" style=""font-size: Small; font-family: TAHOMA; color: #000000""><P>"
$body += "
<table style=""width:100%; border=1"">
<tr>
<th style=""text-align:left; color:blue"">Project </th>
<th style=""text-align:left; color:blue"">DB Status</th>
<th style=""text-align:left; color:blue"">Failed Job</th>
</tr>
<br />
<tr>
<td>Proj A</td>
<td>$groups1</td>
<td>$groups3</td>
</tr>
<tr>
<td> Proj B </td>
<td>$groups2</td>
<td>$groups4</td>
</tr>
<tr>
<td> Proj C</td>
<td>$groups5</td>
<td>$groups7</td>
</tr>
</table><br /><br />"