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
CodePudding user response:
There was the same question asked before, but I won't ask to archive it, 'cause your context of the text is different, so here we are.
I cannot help you right now, but I'll give you enough useful links you can use.
Here:




