Index: sites/all/modules/mimemail/mimemail.inc =================================================================== --- sites/all/modules/mimemail/mimemail.inc (revision 698) +++ sites/all/modules/mimemail/mimemail.inc (working copy) @@ -19,21 +19,31 @@ $header = ''; $crlf = variable_get('mimemail_crlf', "\n"); foreach ($headers as $key => $value) { - $key = trim($key); - // collapse spaces and get rid of newline characters - $value = preg_replace('/(\s+|\n|\r|^\s|\s$)/', ' ', $value); - - //fold headers if they're too long - if (strlen($value) > 60) { - //if there's a semicolon, use that to separate - if (count($array = preg_split('/;\s*/', $value)) > 1) { - $value = trim(join(";$crlf ", $array)); + // this is so we can have multiple BCC, CC etc... + if (!is_array($value)) { + $values = array(); + $values[0] = $value; + } + else { + $values = $value; + } + foreach ($values as $value) { + $key = trim($key); + // collapse spaces and get rid of newline characters + $value = preg_replace('/(\s+|\n|\r|^\s|\s$)/', ' ', $value); + + //fold headers if they're too long + if (strlen($value) > 60) { + //if there's a semicolon, use that to separate + if (count($array = preg_split('/;\s*/', $value)) > 1) { + $value = trim(join(";$crlf ", $array)); + } + else { + $value = wordwrap($value, 50, "$crlf ", FALSE); + } } - else { - $value = wordwrap($value, 50, "$crlf ", FALSE); - } + $header .= "$key: $value$crlf"; } - $header .= "$key: $value$crlf"; } return trim($header); }