Download Weblink notification to originator

You can share your Lua Scripts with everybody here.
Post Reply
Site Admin
Posts: 1917
Joined: Tue Sep 29, 2009 6:09 am

Download Weblink notification to originator

Post by FTP »

First, you should insert the below scripts into "Event Manager -> HTTP -> OnFileDownloaded -> Lua Script":

Code: Select all

local domain = "%Domain"
local username = "%Name"
local weblink = "%WebLink"
local filename = "%FileName"
local client_ip = "%IP"

if username == "<WEBLINK>" then
	local result = c_ExecuteSQL("select f_email from wftp_weblink where f_domain='"..domain.."' and f_is_uplink=0 and f_weblink='"..weblink.."' limit 1")
	if result[1] ~= nil and result[1][0] ~= "" then
		local arrEmail = Split(result[1][0], "|")
		if table.maxn(arrEmail) == 2 and arrEmail[2] ~= "" then
			local notifyEmail = arrEmail[2]
			c_SendMail(notifyEmail, "File downloaded via weblink "..weblink, "Client "..client_ip.." downloaded the file '"..filename.."'.", "", "SMTP_CONFIG") 
Here, "SMTP_CONFIG" is the SMTP configuration name, you can add a SMTP configuration at "Server > Settings > SMTP Manager".


Then you can login the web client and create Weblink for an existed file, just check on the option "Send email to" and input the recipient's email address, and specify the originator's email address in the filed "My email address".
So when the recipient downloads the weblink file, an email notification will be sent to the originator.

Post Reply