Setting up email notifications when a FileZilla queue finishes is super-easy and this article will explain how to do it in a Windows environment.
- PowerShell (ships with Windows 7 — download PowerShell if you’re still using XP)
- A text editor (notepad will suffice, but Sublime Text is my editor-of-choice)
- A Google account (make a new one at accounts.google.com/SignUp because you’ll be storing the password in plaintext)
1. Create a folder on your C: drive called “fn”
2. Create two files in this folder called “fn.bat” and “fn.ps1”
3. Open fn.ps1 in your text editor and enter the following:
$EmailFrom = "SENDER_EMAIL" $EmailTo = "RECIPIENT_EMAIL" $Subject = "EMAIL_SUBJECT" $Body = "EMAIL_BODY" $SMTPServer = "smtp.gmail.com" $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) $SMTPClient.EnableSsl = $true $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("GMAIL_ADDRESS", "GMAIL_PASSWORD"); $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
4. Open fn.bat and enter the following:
5. Open FileZilla and start an upload/download
6. Right-click in the whitespace in the bottom panel > “Action after queue completion” > Run command…
7. Enter the following line in the popup:
8. Now when the queue is complete the email specified in Step 3 will be sent.
First we wrote a PowerShell script which sends an email through Google’s SMTP servers, but FileZilla can’t run it directly so you must make a batch file which can. Then, you simply tell FileZilla to run the batch script when all transfers are complete.
Powershell has what’s called an Execution Policy (read the Execution Policy TechNet documentation for more info) so for this to work you must set it to Unrestricted before any of the above will work by running the following command in an Administrative PowerShell prompt (Right-click on PowerShell > Run as Administrator):
Also, on a 64-bit machine, “Powershell” and “Powershell(x86)” are two separate applications with independent Execution Policies! In my tests the 32-bit version was called by the batch script, but you may as well set the execution policy for both.
Whilst it may seem a bit elaborate to call a batch file which calls a PowerShell script to send an email, as far as I’m aware this is the easiest way to receive email notifications from FileZilla.
You could also use a command line program to send the email – MailSend for example, although I haven’t tested this myself and I much prefer Powershell to third-party applications. If you know any alternative (or easier!) methods let me know.