src/MimeMailer/Helper.php
public static function deduplicate($array)
    {
        if (empty($array)) {
            return $array;
        }
        $known = array();
        foreach ($array as $_index=>$entry) {
            if (is_array($entry)) {
                foreach ($entry as $i=>$_email) {
                    if (!in_array($_email, $known)) {
                        $known[] = $_email;
                    } else {
                        unset($array[$_index]);
                    }
                }
            } elseif (is_string($entry)) {
                if (!in_array($entry, $known)) {
                    $known[] = $entry;
                } else {
                    unset($array[$_index]);
                }
            }
        }
        return $array;
    }
public static function deduplicate($array)
    {
        if (empty($array)) {
            return $array;
        }
        $known = array();
        foreach ($array as $_index=>$entry) {
            if (is_array($entry)) {
                foreach ($entry as $i=>$_email) {
                    if (!in_array($_email, $known)) {
                        $known[] = $_email;
                    } else {
                        unset($array[$_index]);
                    }
                }
            } elseif (is_string($entry)) {
                if (!in_array($entry, $known)) {
                    $known[] = $entry;
                } else {
                    unset($array[$_index]);
                }
            }
        }
        return $array;
    }
De-duplicate a set of name=>email pairs to let each email just once

@param array $array
@return array