Email Alerts notification from sftp accounts before expire

Please post here if you have problems in using Wing FTP Server.
Post Reply
puneet
Posts: 12
Joined: Thu Apr 05, 2018 7:28 am

Email Alerts notification from sftp accounts before expire

Post by puneet »

Hi Team,

We need help as we have many account in wingftp which are set as password based so we need to configure email notification shot for password expiration reaching to threshold XX days

Your help would be appreciable.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Email Alerts notification from sftp accounts before expi

Post by FTP »

Maybe you can use Task scheduler to execute the Lua script (once a day), like the following code:

Code: Select all

do
   --Get user list from domain "domain1"
   local strUserlist = c_GetUserList("domain1")
   local userlist = Split(strUserlist,"\n")

   for _,username in pairs(userlist) do
      local user = c_GetUser("domain1",username)
      local expiretime_t = c_TranslateTime(user.expiretime)

      if user.enable_expire == true and (expiretime_t - os.time()) / 3600*24 == 30 then
	c_SendMail(user.note_email, "FTP Account Expiration","Dear "..username..",\r\n\r\n Your FTP account will be expired soon...","","SMTP")
      end
   end
end
Post Reply