Powershell Script of Sending an HTML Email Report in a Formatted Table

This is a re-post from Powershell expert “Ben Wilkinson“, the original ps function is here. I did have some trouble in making it work in my own script and found that I have to add opening and closing “style” tags in the css definition part to make it work. So here I am writing a memo about this:

if (!$CSS) 


# Please use the download link to get the CSS it may not display correctly here.     

$CSS = @" 


            table { 

            font-family: Verdana; 

            border-style: dashed; 

            border-width: 1px; 

            border-color: #FF6600; 

            padding: 5px; 

            background-colo​r: #FFFFCC; 

            table-layout: auto; 

            text-align: center; 

            font-size: 8pt; 



            table th { 

            border-bottom-s​tyle: solid; 

            border-bottom-w​idth: 1px; 

            font: bold 


            table td { 

            border-top-styl​e: solid; 

            border-top-widt​h: 1px; 


            .style1 { 

            font-family: Courier New, Courier, monospace; 






}#End if 


About Nick Xu

Not a DBA anymore
This entry was posted in Powershell and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s