View Categories

Email Example

For this example we’ll use a powershell script that sends an email to the admin when a new file has been uploaded to ProVide.

# Setup script parameters
param ([Parameter(Mandatory=$true)][string]$local, [Parameter(Mandatory=$true)][string]$ftp)
# Email parameters
$SMTPServer = “mailserver.domain.com”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) $SMTPClient.EnableSsl = $true
# The email address that will appear to be the sender of the email. $EmailFrom = “from@domain.com”
# The email address that will receive the email.
$EmailTo = “to@domain.com”
# This will be the subject of the email.
$Subject = “New file”
# The email text that will be sent will be what is contained within the ‘@”‘ in the start and the ‘”@’ in the end.
$Body = @”
A new file has arrived through $ftp, ending up in $local.
Best regards,
ProVide
“@
# If credentials are required for sending through this SMTP server $SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“domain\user”, “password”);
# If we should skip certification validation check for this SMTP server [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { return $true }
# Now we are ready to send the message $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

We want this script to trigger when a user is done uploading a file so go to the “Messages and events” in the provide administrator interface and select “OnUploadEnd” from the drop-down menu. We want to add the follow line to the message box:

%EXECUTE(Powershell.exe -File “c:\PATH\TO\SCRIPT\SCRIPT.ps1” -local “%LOCAL_FILENAME%” -ftp “%FTP_FILENAME%”)%

This line is telling ProVide that when the upload has been finished it will execute the powershell script located at the path and it will send with it the ‘local_filename’ and ‘ftp_filename’.

If you wish to read more about this subject you can go to our CMD examples.

Your Cart

Header test Qty Price
display quantity price
Product Name Qty Price

Extended offer, we're celebrating 20 years! 🎉 Dec 01 - Dec 31

New customers: 20% off – use code CELEBRATE2025

MEGA customers: 6 hours free support – use code MEGA2025

Existing customers: Get 50% off your upgrade – contact Louise

Recommended Products

Subtotal: Total

Total (inc. VAT): Total

Tax: Total

You save:
Total

maxi_provideserver

Choose your version of ProVide Server to download

For the ultimate experience of ProVide’s features and functions,
we recommend choosing the MAXI License.

Follow the 3 easy steps below to install ProVide Server
  1. Download the version you need using the buttons below.
  2. Get a free MAXI trial license by clickingk the “Get Maxi Trial License” button and enter your email. The license key will be sent to your email.
  3. Activate the license key by following this simple step-by-step-guide.

Your Cart

Header test Qty Price
display quantity price
Product Name Qty Price

Extended offer, we're celebrating 20 years! 🎉 Dec 01 - Dec 31

New customers: 20% off – use code CELEBRATE2025

MEGA customers: 6 hours free support – use code MEGA2025

Existing customers: Get 50% off your upgrade – contact Louise

Thank you for showing interest in trying ProVide Server

Follow the 3 easy steps below to install ProVide Server

  1. Download the version you prefer 32-bit or 64-bit
  2. Activate the license key by clicking on the ‘Request trial’ button below and enter your email. The key will then be sent to that address.
  3. To enter the license key follow this guide: free-trial

Subtotal: Total

Total (inc. VAT): Total

Tax: Total

You save: Total

Free Trial

Get
ProVide Software