title: Powershell query- Could not find a part of the path
body: <p>I am trying to work on a power shell script to query email id's from a csv list and send out bulk personalized emails.Both the csv file and the script are located on the desktop in the same folder(\DECSRV02\Folder Redirection\paranjyoti\Desktop\Powershell_massemail).
  The script contains the csv import as : </p>
  
  <pre><code>$csv = Import-Csv 'C:\Users\paranjyoti\Desktop\Powershell_massemail\UserList.csv'
  $Credential = Get-Credential
  Foreach($Message in $csv){
  $Recipient = $Message.EmailAddress
  $FirstName = $Message.FirstName
  $LastName = $Message.Surname
  $Course = $Message.Course
  $Grade = $Message.Grade
  $Subject = "$FirstName $LastName - $Course Exam Result"
  Write-Host "Sending email to $FirstName $LastName"
  Write-Host "Email Address: $Recipient"
  $mailBody = 
  @"
  Hello $FirstName,&lt;/br&gt;
  We have marked your recent exam and the results are as follows:&lt;/br&gt;
  &lt;/br&gt;
  Student Name: $LastName, $FirstName&lt;/br&gt;
  Course: $Course&lt;/br&gt;
  Result: $Grade&lt;/br&gt;
  &lt;/br&gt;
  Thank you for taking a course at our school,&lt;/br&gt;
  The Faculty
  "@
  
  Send-MailMessage -Body $mailBody -BodyAsHtml `
  -From "faculty@greatschool.com" -To $Recipient `
  -Subject $subject -Encoding $([System.Text.Encoding]::UTF8) `
  -Credential $Credential -SmtpServer "smtp.office365.com" -UseSSLcopy
  }
  </code></pre>
  
  <p>While running the script, the error comes up as "Could not find a part of the path"
  <a href="https://i.stack.imgur.com/gx3RA.png" rel="nofollow noreferrer">The attached error message image is shown</a>
  Please can you help in identifying the error. </p>