Hi All
This is a script to find if an email address is valid or not and also if it is valid produce some information. This is outputed to 2 Csv files
This part of the code creates two tables in html one for valid address and one for invalid address and exports to html file, this works fine.
My query is these tables are the same colour. How can i change the layout colours for each table so they are different but stillsent the output to one html file.
$("<span style=""color:Red""> Address NOT VALID </span><br><br>")
$($errorList | ConvertTo-Html -Fragment)
$("<span style=""color:Red""> </span><br><br>")
$("<span style=""color:blue""> Address Valid </span><br><br>")
$($validUsers | ConvertTo-Html -Fragment)
*****
userlist = Get-Content "c:userlist.txt"
foreach ($user in $userlist)
{
$error.Clear()
$validUser = Get-Recipient $user | Select-Object Displayname, Database, PrimarySmtpAddress,name,RecipientType,DistinguishedName
if (@($error).Count -gt 0)
{
$userData = @{"Invalid Address"=$user}
New-Object -TypeName PSObject -Property $userData -OutVariable invalidUser | Out-Null
$errorlist += $invalidUser
$error.Clear()
}
else
{
$validUsers += $validUser
}
}
if (($errorList | Measure-Object).Count -gt 0)
{
$errorList | export-csv "$reportcsvEmailaddexistsnot" -NoTypeInformation
}
$validUsers | Export-Csv "$reportcsvEmailaddexists" -NoTypeInformation
$Report =
@"
<!DOCTYPE HTML>
<html>
<Head>
<style>
table, th, td {
font-family: calibri,arial,verdana;
color: white;
border: 2px solid white;
border-collapse: collapse;
background-color: #66CCFF;
}
</style>
</head>
$("<span style=""color:Red""> Email does Exist</span><br><br>")
$($errorList | ConvertTo-Html -Fragment)
$("<span style=""color:Red""> </span><br><br>")
$("<span style=""color:blue""> Email ADDRESS DOES Exist</span><br><br>")
$($validUsers | ConvertTo-Html -Fragment)
</building>
</html>
"@
$report | out-file c:report.html