title: Join an array with newline in PowerShell
body: <p>I have an array of names that I'm trying to join using a new line character.  I have the following code</p>
  
  <pre><code>$body = $invalid_hosts -join "`r`n"
  $body = "The following files in $Path were found to be invalid and renamed `n`n" + $body
  </code></pre>
  
  <p>Finally, I send the contents via email.</p>
  
  <pre><code>$From = "myaddress@domain.com"
  $To = "myaddress@domain.com
  $subject = "Invalid language files"
  
  Send-MailMessage -SmtpServer "smtp.domain.com" -From $From -To $To -Subject $subject -Body $body
  </code></pre>
  
  <p>When I receive the message, the line <code>The following files in &lt;filepath&gt; were found to be invalid and renamed</code> has the expected double space, but the contents of $invalid_hosts are all on one line. I've also tried doing</p>
  
  <pre><code>$body = $invalid_hosts -join "`n"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$body = [string]::join("`n", $invalid_hosts)
  </code></pre>
  
  <p>Neither way is working. What do I need to do to make this work?</p>