title: Powershell email output not formatting correctly
body: <p>I have spent the last few hours trying various ways to solve my problem below, adding parts from other working scripts that I have and researching on here, yet have reached the point where I need a fresh set of eyes to point the obvious out to me.</p>
  
  <p>This is my script, which does the following:</p>
  
  <ul>
  <li>Lists all folders in a certain location, puts the folder paths in a text file</li>
  <li>In a loop, uses the text file to check the most recent file in each folder, then output the most recent 10 timestamps (denoted by '[')</li>
  <li>Emails the results</li>
  </ul>
  
  <p>All of the above works, I have the email with the correct information. The problem is that the email arrives all on the same line with no formatting.</p>
  
  <p>I've taken my style tags from a previous working script that I had, so I'm not sure where I've gone wrong. Any ideas?</p>
  
  <pre><code>$style = "&lt;style&gt;BODY{font-family: Arial; font-size: 10pt;}"
  $style = $style + "TABLE{border: 1px solid black; border-collapse:collapse;}"
  $style = $style + "TH{border: 1px solid black; background: #dddddd; padding:     5px; }"
  $style = $style + "TD{border: 1px solid black; padding: 5px; }"
  $style = $style + "&lt;/style&gt;"
  $subject = "Processing Log Check at " + (Get-Date -Format g)
  $logpaths = Get-Content -Path C:\Powershell\xxxx\scenariologlocation.txt 
  $output = foreach ($logpath in $logpaths)
  {
  Write-Output $logpath
  Get-ChildItem -path $logpath | sort LastWriteTime | select -ExpandProperty FullName -last 1 | Out-File C:\Powershell\path.txt
  $path = Get-Content -Path C:\Powershell\path.txt
  Get-Content -Path $path | Select-String -SimpleMatch "[" | select Line -last 10 | format-table -HideTableHeaders | Out-String
  }
  $body = (ConvertTo-Html -Head $style -body $output | Out-String)
  Send-MailMessage -From "xxxxxx" -To "xxxxxx" -Subject $subject -Body $body -BodyAsHtml -SmtpServer "xxxxxxx"
  </code></pre>