title: Powershell script unable to send to multiple recipients
body: <p>I'm using a powershell script that will create an HTML report of disk space and send it as an email.  Unfortunately I'm unable to get the script to send to more than one email recipient.  The script I'm using can be found here:</p>
  <p><a href="http://gallery.technet.microsoft.com/scriptcenter/6e935887-6b30-4654-b977-6f5d289f3a63" rel="nofollow noreferrer">http://gallery.technet.microsoft.com/scriptcenter/6e935887-6b30-4654-b977-6f5d289f3a63</a></p>
  <p>Here are the relevant parts of the script...</p>
  <pre><code>$freeSpaceFileName = &quot;FreeSpace.htm&quot; 
  $serverlist = &quot;C:\sl.txt&quot; 
  $warning = 90 
  $critical = 75 
  New-Item -ItemType file $freeSpaceFileName -Force 
  
  Function sendEmail 
  { param($from,$to,$subject,$smtphost,$htmlFileName) 
  $body = Get-Content $htmlFileName 
  $smtp= New-Object System.Net.Mail.SmtpClient $smtphost 
  $msg = New-Object System.Net.Mail.MailMessage $from, $to, $subject, $body 
  $msg.isBodyhtml = $true 
  $smtp.send($msg) 
  } 
  
  $date = ( get-date ).ToString('yyyy/MM/dd') 
  $recipients = &quot;to1@email.com&quot;, &quot;to2@email.com&quot;
  sendEmail from@email.mail $recipients &quot;Disk Space Report - $Date&quot; smtp.server $freeSpaceFileName
  </code></pre>
  <p>I'm getting the following error</p>
  <pre><code>New-Object : Exception calling &quot;.ctor&quot; with &quot;4&quot; argument(s): &quot;The specified string is not in the form required for an e
  -mail address.&quot;
  At E:\DiskSpaceReport.ps1:129 char:18
  + $msg = New-Object &lt;&lt;&lt;&lt;  System.Net.Mail.MailMessage $from, $to, $subject, $body
  + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
  + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
  </code></pre>