title: How to send emails based on my data. csv file
body: <p>I do a monthly report on inactive accounts and would like to send an email to the managers who are responsible for the service accounts to notify them that the accounts have not been used for more than 30 days based on my data. csv file. When I run my script it only shows one user in the email for each entry in the csv file.</p>
  <pre><code>$Users = 
  @&quot;
  Manager;inactiveADAccount
  manager_1@domain.com;test_1;test_2;test_3
  manager_2@domain.com.ca;test_4
  &quot;@ | ConvertFrom-Csv -Delimiter &quot;;&quot;
  
  
  ForEach($Manager in $Users) {
  
  
  $bodytxt = @&quot;
  
  Hello,
  
  Please verify users below
  $($Manager.inactiveADAccount)
  
  &quot;@
  
  
  $Message      = New-Object System.Net.Mail.MailMessage
  $Message.From = New-Object System.Net.Mail.MailAddress 'me@domain.com'
  $To           = $Manager.Manager
  $Object       = &quot;Inactive Accounts&quot;
  $body         = $bodytxt
  $SMTPServer   = 'mail.domain.com'
  
  
  Send-MailMessage -From $Message.From -To $To -Subject $Object -Body $body -BodyAsHtml -SmtpServer $SMTPServer -Priority High -Encoding UTF8
  
  }
  </code></pre>