Index: branches/RC/core/kernel/utility/email_send.php =================================================================== diff -u -N -r11349 -r11657 --- branches/RC/core/kernel/utility/email_send.php (.../email_send.php) (revision 11349) +++ branches/RC/core/kernel/utility/email_send.php (.../email_send.php) (revision 11657) @@ -562,11 +562,6 @@ */ function SetEncodedEmailHeader($header, $address, $name) { - if ($header == 'To') { - // in case, when header is set directly - $address = $this->_replaceRecipientEmail($address); - } - $this->SetHeader($header, $this->QuotedPrintableEncode($name, $this->charset).' <'.$address.'>'); } @@ -1105,7 +1100,7 @@ $this->SetReturnPath($from_email); } - $this->SetEncodedEmailHeader('To', $to_email, $to_name ? $to_name : $to_email); + $this->SetTo($to_email, $to_name ? $to_name : $to_email); return $this->Deliver(); } @@ -1794,6 +1789,21 @@ } /** + * Sets "To" header. + * + * @param string $email + * @param string $first_last_name FirstName and LastName or just FirstName + * @param string $last_name LastName (if not specified in previous parameter) + */ + function SetTo($email, $first_last_name, $last_name = '') + { + $name = rtrim($first_last_name.' '.$last_name, ' '); + $email = $this->_replaceRecipientEmail($email); + + $this->SetEncodedEmailHeader('To', $email, $name ? $name : $email); + } + + /** * Sets "Return-Path" header (useful for spammers) * * @param string $email @@ -1812,8 +1822,6 @@ */ function AddTo($email, $first_last_name = '', $last_name = '') { - $email = $this->_replaceRecipientEmail($email); - $name = rtrim($first_last_name.' '.$last_name, ' '); $this->AddRecipient('To', $email, $name); } @@ -1874,6 +1882,8 @@ */ function AddRecipient($header_name, $email, $name = '') { + $email = $this->_replaceRecipientEmail($email); + if (!$name) { $name = $email; }