I am not good at html I am trying to create a table in outlook email like below (without colors)
I tried below code but not able to get this format
$HtmlTable = "<table border='1' align='Left' cellpadding='2' cellspacing='0' style='color:black;font-family:arial,helvetica,sans-serif;text-align:left;'>
<tr style ='font-size:12px;font-weight: normal;background: #FFFFFF'>
<th align=left><b>Customer Name*</b></th>
<th align=left><b>SERVER NAME</b></th>
<th align=left><b>IP Address</b></th>
<th align=left><b>Hostname without FQDN</b></th>
<th align=left><b>Server OS flavour (Drop Down)</b></th>
<th align=left><b>Datacenter</b></th>
</tr>"
$HtmlTable += "<tr style='font-size:12px;background-color:#FFFFFF'>
<td>" + "MYCOMPANY" + "</td>
<td>" + "TESTSERVER" + "</td>
<td>" + "10.10.10.10" + "</td>
<td>" + "test" + "</td>
<td>" + "test1" + "</td>
<td>" + "test2" + "</td>
</tr>"
$HtmlTable += "</table>"
Send-MailMessage -from $fromEmail -to $toEmail -Cc $toCCmail1 -SmtpServer $smtpServer -Body $HtmlTable -Subject " Report" -BodyAsHtml
Output in email
the data I have like below
$VM = get-vm | where {($_.Name -match $hostname)} | SELECT -Unique
$Summary = $VM | select @{N="DNSName";E={$_.ExtensionData.Guest.Hostname}}, @{N="IPAddress";E={$_.Guest.IPAddress[0]}}, @{N=”Datacenter”;E={Get-Datacenter -VM $_}}
$DNS = $Summary.DNSName
$pos = $DNS.IndexOf(".")
$DNSName = $DNS.Substring(0, $pos)
$GuestOS = $VM.Guest.OSFullName
$IPAddress = $Summary.IPAddress
$dc = $Summary.Datacenter
Please need your help to get this html format
With respect to the solution provided by @Theo
email body
$body = @"
<html>
Hi Team, <br /><br />
Please raise a ticket CPU & memory situation from below servers. <br /><br />
<b>Unmapp (Remove) below Situations -</b><br />
MEMORY_USED_WARN<br />
MEMORY_USED_CRIT<br />
CPU_Warning<br />
<br /><br />
$htmlTemplate -replace '@@TABLES@@', ($tables -join '<br />')
Thank you <br /><br />
***This is an auto-generated email. Please do not respond***
</html>
"@



