Email notifications for Group

You can share your Lua Scripts with everybody here.
Post Reply
impact
Posts: 19
Joined: Fri May 10, 2013 1:39 pm

Email notifications for Group

Post by impact »

Hello,

we'd live to configure notification emails for Group instead of account.

Now we have configured something like this

if ("%Name" == "test") then
c_SendMail("test@test.it","text","text","","smtp")
end

Is it possible to substitute account name (%Name) with group?
Which is the syntax for Group name?

I tried with %Group and %GroupName but it didn't work
impact
Posts: 19
Joined: Fri May 10, 2013 1:39 pm

Re: Email notifications for Group

Post by impact »

Anyone???
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Email notifications for Group

Post by FTP »

OK, here is an example, finding the first group, and send email for the first group, anyway, you can modify the following Lua script for your own requirement:

Code: Select all

do
        local user = c_GetUser("%Domain", %Name)
        local grouplist = user["usergroups"]  
        
        for _,tempgroup in pairs(grouplist) do 
		local groupname= tempgroup["groupname"]
                if groupname == "CUSTOMERS" then
			c_SendMail("test111@test.it","text","text","","smtp")
                        break
		elseif groupname == "BOSS" then
			c_SendMail("test222@test.it","text","text","","smtp")
                        break
                end
	end
end
seattle
Posts: 28
Joined: Tue Nov 07, 2017 7:31 pm

Re: Email notifications for Group

Post by seattle »

anyone have something like this working with version 5.0.9 ?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Email notifications for Group

Post by FTP »

seattle wrote:anyone have something like this working with version 5.0.9 ?
I think it can work for the recent versions, any problem?
Post Reply