title: PowerShell Script for Email Notification
body: <p>I am using a FileZilla Server as an FTP. I want to create a PowerShell script that will send an email as soon as a file is uploaded.</p>
  <p>I have been using the knowledge in this article: <a href="https://richjenks.com/filezilla-email-notifications/" rel="nofollow noreferrer">https://richjenks.com/filezilla-email-notifications/</a></p>
  <p>and below is the code of my fn.ps1 file</p>
  <pre><code>$EmailFrom = &quot;SENDER_EMAIL&quot;
  $EmailTo = &quot;RECIPIENT_EMAIL&quot;
  $Subject = &quot;New File Uploaded to FileZilla&quot;
  $Body = &quot;A new file has been uploaded to the FTP server on FileZilla&quot;
  
  $SMTPServer = &quot;127.0.0.1&quot;
  $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 21)
  $SMTPClient.EnableSsl = $true
  
  $SMTPClient.Credentials = New-Object 
  System.Net.NetworkCredential(&quot;GMAIL_ADDRESS&quot;, &quot;GMAIL_PASSWORD&quot;);
  
  $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
  </code></pre>
  <p>The only problem is that no email is actually sent? I can see the PowerShell pop up briefly after a file is uploaded so it is being run upon file upload, however no email is actually sent anywhere.</p>
  <p>Any help would be greatly appreciated.</p>
  <p>EDIT: I am not entirely sure what is the relationship between &quot;SENDER_EMAIL&quot; and &quot;GMAIL_ADDRESS&quot;, I found the above solution on another website and they are different, should these not be the same?</p>