Send mail only in upload for a certain directory/User

You can share your Lua Scripts with everybody here.

Send mail only in upload for a certain directory/User

Postby Megalomaniac » Mon Aug 05, 2013 7:33 am

Hello,

I would like to have a script that only sends a mail when an upload has been done to a certain folder. Can anybody help me with that I am really a newbie to this scripting.
Megalomaniac
 
posts 4
 
joined Fri Oct 21, 2011 9:36 am

Re: Send mail only in upload for a certain directory/User

Postby FTP » Tue Aug 06, 2013 11:27 am

You can use the following Lua script:

Code: Select all
local filepath = "%PathName"
local username = "%Name"
   
if username == "aa" and string.find(filepath,"d:/FolderA") then
   c_SendMail("xxx@test.com","a file has been uploaded","%Name uploaded into %PathName","","SMTP_CONFIG")
elseif username == "bb" and string.find(filepath,"d:/FolderB") then
   c_SendMail("yyy@test.com","a file has been uploaded","%Name uploaded into %PathName","","SMTP_CONFIG")
elseif username == "cc" and string.find(filepath,"d:/FolderC") then
   c_SendMail("zzz@test.com","a file has been uploaded","%Name uploaded into  %PathName","","SMTP_CONFIG")
end
FTP
Site Admin
 
posts 1220
 
joined Tue Sep 29, 2009 6:09 am

Re: Send mail only in upload for a certain directory/User

Postby Megalomaniac » Thu Sep 12, 2013 11:37 am

Ok, I understand. Where do I need to enter that in WingFTP?
Megalomaniac
 
posts 4
 
joined Fri Oct 21, 2011 9:36 am

Re: Send mail only in upload for a certain directory/User

Postby FTP » Mon Sep 16, 2013 7:29 am

You just need to add that scripts into the "Event Manager -> FTP(HTTP/SSH) Events -> OnFileUploaded".
FTP
Site Admin
 
posts 1220
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest