title: Powershell Runbook Email with the csv file attachment
body: <p>I want to send an email from my powershell runbook script, I wouild like to attach CSV file as the script output which is stored in storage blob on my azure subscription. </p>
  
  <p>The script is ready, I am receiving email but without attachment. I am still facing the issue, and when I am executing script from Azure automation, as a runbook, I can see below error message. I am storing all files in the same container.</p>
  
  <p>New-Object : Exception calling ".ctor" with "1" argument(s): "Could not find file 
  'C:\Users\Client\Temp\xxxxxxxx.csv'." </p>
  
  <p>this is my output --> $ArrayStatus | Export-Csv -NoTypeInformation -Path "$filename"</p>
  
  <p>$filename is a CSV file location</p>
  
  <pre><code>$ArrayStatus | Export-Csv -NoTypeInformation -Path "$filename"
  Get-AzureStorageBlob -Container "xxx" -Blob "$filename" -Context $Context 
  Get-AzureStorageBlobContent -force
  $attachment = "$filename"
  
  Function Email ($EmailTo, $Body){
  $EmailFrom = "xxx"
  $Subject = "xxx Alert" 
  $SMTPServer = "xxx" 
  $SMTPMessage = New-Object 
  System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
  $attach = New-Object System.Net.Mail.Attachment($attachment)
  $SMTPMessage.Attachments.Add($attach)
  $SMTPMessage.IsBodyHTML = $false
  $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, xx) 
  $SMTPClient.EnableSsl = $true 
  $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("xx", 
  "xx");  
  $SMTPClient.Send($SMTPMessage)
              }
  </code></pre>
  
  <p>I am receiving email but without CSV file attachment</p>