Page 1 of 1

send automatic mail

Posted: Sun Feb 23, 2025 9:34 pm
by CCURAU
I recently use GENE6 ftp server in which a very usefull fonction is included.
Every user can select if he want to receive an automatic email when another user deposit a new document in the server.
You can also send a message to the document's owner when othres user download or read his documents.
This function can be included in the NOTES user section and use the emails enclosed .
An automatic mail can be generate at the domain or server level

Best regards

Re: send automatic mail

Posted: Fri Feb 28, 2025 3:56 am
by FTP
OK, first you need to define the email addresses for every account under "User -> Notes -> Email address", and then use the following lua script in the event "OnFileUploaded":

Code: Select all

local domain = "%Domain"
local strUserlist = c_GetUserList(domain) 
local userlist = Split(strUserlist,"\n") 

for _,username in pairs(userlist) do 
	local user = c_GetUser(domain, username)
	if user ~= nil and user.note_email ~= nil and user.note_email ~= "" then 
		c_SendMail(user.note_email,"a file has been uploaded","%Name uploaded the file %FileName","","SMTP_CONFIG") 
	end
end

Here, "SMTP_CONFIG" is the SMTP configuration name under "Servers -> Settings -> SMTP Manager". If you have lots of user accounts, it may take a while to send all the emails.