Send mail only in upload for a certain directory/User

You can share your Lua Scripts with everybody here.
Post Reply
Megalomaniac
Posts: 4
Joined: Fri Oct 21, 2011 9:36 am

Send mail only in upload for a certain directory/User

Post by Megalomaniac »

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.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

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

Post by FTP »

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
Megalomaniac
Posts: 4
Joined: Fri Oct 21, 2011 9:36 am

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

Post by Megalomaniac »

Ok, I understand. Where do I need to enter that in WingFTP?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

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

Post by FTP »

You just need to add that scripts into the "Event Manager -> FTP(HTTP/SSH) Events -> OnFileUploaded".
Post Reply