im_email_people_in_group db group_id role from subject messageWhat it does:
Emails the message to all people in the group who are acting in the specified roleDefined in: /web/philip/tcl/intranet-defs.tcl
Source code:
# Until we use roles, we only accept the following: set second_group_id "" switch $role { "employees" { set second_group_id [im_employee_group_id $db] } "customers" { set second_group_id [im_customer_group_id $db] } } set criteria [list] if { [empty_string_p $second_group_id] } { if { [string compare $role "all"] != 0 } { return "" adde } } else { lappend criteria "ad_group_member_p(u.user_id, '$second_group_id') = 't'" } lappend criteria "ad_group_member_p(u.user_id, '$group_id') = 't'" set where_clause [join $criteria "\n and "] set email_list [database_to_tcl_list $db "select email from users_active u where $where_clause"] # Remove any html tags from the message regsub -all -nocase {<p>} $message {<br><br>} message regsub -all -nocase {<br>} $message "\n" message set message [util_striphtml $message] foreach email $email_list { catch { ns_sendmail $email $from $subject $message } }