title: Read from multiple text files and email to recipient
body: <p>I'm very new to powershell so please forgive the way I word this if it is not clear.</p>
  
  <p>I have powershell command that will read a line in a text file and email it to a recipient.
  As you can see in the code below it's looking for a file which conains "ama" - Which it does fine.</p>
  
  <p>However, sometimes there are multiple files in the directory with "ama" in the file name. I'd like it to send an email for each file that has "ama" in the name. Either an individual email for each file, or a summary which reads the same line in all the "ama" files in the directory.</p>
  
  <p>Can this be done?</p>
  
  <p>Many thanks.</p>
  
  <pre><code>$a=Get-Content -Path "S:\Vecta\Test\*ama.*" | select -first 1 -skip 9 
  $a = $a.substring(3,16)
  $b = "Imported"
  $msg.Body=$a
  
  #$msg.Body=Get-Content -Path "S:\Vecta\Test\*ama.*" | select -first 1 -skip 9 |  Out-String 
  
  #Message Subject
  $msg.Subject=$b
  
  $smtp.Send($msg)
  #$attachment.Dispose();
  $msg.Dispose();
  </code></pre>