[dev] [Patch] IMP compose to repeated recipient

k-team k-team kteam.eu at gmail.com
Fri Jan 21 07:22:55 PST 2005


To prevent multiple sending to the same recipient, the following patch
could be applied to the imp file compose.php:

function cleanField($field) {
	$fieldArray=array_unique(preg_split("/,\s*/",$field));
	return join($fieldArray, ",");
}


/**
 * Returns a To:, Cc: or Bcc: list build from a selection based on 'expand
 * names'.
 */
function _getAddressList($field, $expand = false)
{
	
    $to = cleanField(trim(Util::getFormData($field)));
    
    if (!empty($to)) {
    	//error_log('expand? ' . $expand);
        return $expand ? $to : _formatAddr($to);
    }

    $to_list = Util::getFormData($field . '_list');
    $to = Util::getFormData($field . '_field');

    
    $tmp = array();
    
    
    if (is_array($to)) {
        foreach ($to as $key => $address) {
            $tmp[$key] = $address;            
        }
    }
    if (is_array($to_list)) {
        foreach ($to_list as $key => $address) {
            if ($address != '') {
                $tmp[$key] = $address;
            }
        }
    }

    $to_new = trim(Util::getFormData($field . '_new'));
    if (!empty($to_new)) {
        $tmp[] = $to_new;
    }
    return implode(', ', $tmp);
}


More information about the dev mailing list