title: Sending multi line of body and multiple attachments
body: <p>I have two different folders containing two text files, the goal is to send both txt files in an email using PowerShell. 
  The first file is stored in log and the other one in Error. I found a helpful PowerShell script to do so, however I was not sure how to add both attachments in same email and in the body having two lines for each of the attachments. Below is the script, any help is appreciated:</p>
  
  <pre><code># Date values to find related log file for the day and hour or the run
  $y = Get-Date -format yyyy
  $m = Get-Date -format MM
  $d = Get-Date -format dd
  $h = Get-Date -format 05
  # Modify the log path
  $LogPath       = "C:\Program Files\Logs\"
  $LogFile       = $LogPath + "Log_" + $y + $m  + $d + "_" + $h + "*.txt" 
  $LogFileName   = $LogFile | ? {Test-Path $LogFile} | Get-ChildItem | Where-Object { $_ -is [System.IO.FileInfo] }
  
  $LogPath1       = "C:\Program Files\ERROR\"
  $LogFile1       = $LogPath1 + "Log_" + $y + $m  + $d + "_" + $h + "*.txt" 
  $LogFileName1   = $LogFile1 | ? {Test-Path $LogFile} | Get-ChildItem | Where-Object { $_ -is [System.IO.FileInfo] }
  
  $MessageBodyNA = "Email from scheduler. No log file found  " + $LogFile
  $MessageBodyA  = "Email from scheduler. File" + $LogFileName + " found and attached"
  
  $MessageBodyNA1 = "Email from scheduler. No log file found " + $LogFile1
  $MessageBodyA1  = "Email from scheduler. File(s) " + $LogFileName1 + " found and attached"
  
  $FromAddress   = "test@gmail.com"
  
  $ToAddress     = "test1@gmail.com"
  $Subject       = "test"
  
  $SMTPserver    = "SMTPServerName.com"
  
  
  if ( $LogFileName | Where-Object { $_ -is [System.IO.FileInfo] })
  {
    send-mailmessage -from $FromAddress -to $ToAddress -subject $Subject -body  $MessageBodyA  -smtpServer $SMTPserver -Attachments $LogFileName
  }
  else
  {
    send-mailmessage -from $FromAddress -to $ToAddress -subject $Subject -body  $MessageBodyNA  -smtpServer $SMTPserver
  }
  
  if ( $LogFileName1 | Where-Object { $_ -is [System.IO.FileInfo] })
  {
    send-mailmessage -from $FromAddress -to $ToAddress -subject $Subject -body  $MessageBodyA1  -smtpServer $SMTPserver -Attachments $LogFileName1
  }
  else
  {
    send-mailmessage -from $FromAddress -to $ToAddress -subject $Subject -body  $MessageBodyNA1  -smtpServer $SMTPserver
  }
  </code></pre>