Index: email_send.php =================================================================== --- email_send.php (revision 15383) +++ email_send.php (working copy) @@ -161,7 +161,6 @@ $this->SetCharset(null, true); } - /** * Returns new message id header by sender's email address * @@ -583,20 +582,19 @@ */ function SetEncodedEmailHeader($header, $address, $name) { - $this->SetHeader($header, $this->QuotedPrintableEncode($name, $this->charset).' <'.$address.'>'); + $this->SetHeader($header, $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $address . '>'); } function SetMultipleEncodedEmailHeader($header, $addresses) { $value = ''; foreach ($addresses as $name => $address) { - $value .= $this->QuotedPrintableEncode($name, $this->charset).' <'.$address.'>, '; + $value .= $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $address . '>, '; } $this->SetHeader($header, substr($value, 0, -2)); } - /** * Adds new part to message and returns it's number * @@ -1944,9 +1942,14 @@ } $value = isset($this->headers[$header_name]) ? $this->headers[$header_name] : ''; - $value .= ', ' . $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $email . '>'; - $this->SetHeader($header_name, substr($value, 2)); + if ( $value ) { + // not first recipient added - separate with comma + $value .= ', '; + } + + $value .= $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $email . '>'; + $this->SetHeader($header_name, $value); } /**