Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl,v diff -u -r1.46 -r1.47 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 21 May 2006 07:54:03 -0000 1.46 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 21 May 2006 13:14:04 -0000 1.47 @@ -1166,11 +1166,30 @@ } } } - - foreach to_id [group::get_members -group_id $to_group_ids] { - lappend to_party_ids $to_id - } + # Run through the party_ids and check if a group is in there. + set new_to_party_ids [list] + foreach to_id $to_party_ids { + if {[group::group_p -group_id $to_id]} { + lappend to_group_ids $to_id + } else { + if {[lsearch $new_to_party_ids $to_id] < 0} { + lappend new_to_party_ids $to_id + } + } + } + + foreach group_id $to_group_ids { + foreach to_id [group::get_members -group_id $group_id] { + if {[lsearch $new_to_party_ids $to_id] < 0} { + lappend new_to_party_ids $to_id + } + } + } + + # New to party ids contains now the unique party_ids of members of the groups along with the parties + set to_party_ids $new_to_party_ids + # Now the Cc recipients set cc_list [list] @@ -1187,10 +1206,29 @@ } } - foreach cc_id [group::get_members -group_id $cc_group_ids] { - lappend cc_party_ids $cc_id - } + # Run through the party_ids and check if a group is in there. + set new_cc_party_ids [list] + foreach cc_id $cc_party_ids { + if {[group::group_p -group_id $cc_id]} { + lappend cc_group_ids $cc_id + } else { + if {[lsearch $new_cc_party_ids $cc_id] < 0} { + lappend new_cc_party_ids $cc_id + } + } + } + + foreach group_id $cc_group_ids { + foreach cc_id [group::get_members -group_id $group_id] { + if {[lsearch $new_cc_party_ids $cc_id] < 0} { + lappend new_cc_party_ids $cc_id + } + } + } + # New to party ids contains now the unique party_ids of members of the groups along with the parties + set cc_party_ids $new_cc_party_ids + # Now the Bcc recipients set bcc_list [list] @@ -1207,10 +1245,29 @@ } } - foreach bcc_id [group::get_members -group_id $bcc_group_ids] { - lappend bcc_party_ids $bcc_id - } + # Run through the party_ids and check if a group is in there. + set new_bcc_party_ids [list] + foreach bcc_id $bcc_party_ids { + if {[group::group_p -group_id $bcc_id]} { + lappend bcc_group_ids $bcc_id + } else { + if {[lsearch $new_bcc_party_ids $bcc_id] < 0} { + lappend new_bcc_party_ids $bcc_id + } + } + } + + foreach group_id $bcc_group_ids { + foreach bcc_id [group::get_members -group_id $group_id] { + if {[lsearch $new_bcc_party_ids $bcc_id] < 0} { + lappend new_bcc_party_ids $bcc_id + } + } + } + # New to party ids contains now the unique party_ids of members of the groups along with the parties + set bcc_party_ids $new_bcc_party_ids + # Rollout support (see above for details) set delivery_mode [ns_config ns/server/[ns_info server]/acs/acs-rollout-support EmailDeliveryMode] @@ -1248,7 +1305,7 @@ foreach party $bcc_party_ids { lappend bcc_list "[party::name -party_id $party] <[party::email -party_id $party]>" } - + smtp::sendmessage $multi_token \ -header [list From "$from_string"] \ -header [list To "[join $to_list ","]"] \