浏览代码

keep the name

euromark 12 年之前
父节点
当前提交
695dd353ed
共有 1 个文件被更改,包括 22 次插入2 次删除
  1. 22 2
      Lib/EmailLib.php

+ 22 - 2
Lib/EmailLib.php

@@ -449,8 +449,28 @@ class EmailLib extends CakeEmail {
 
 		// Security measure to not sent to the actual addressee in debug mode
 		if (Configure::read('debug')) {
-			$this->to(Configure::read('Config.adminEmail'), Configure::read('Config.adminName'));
-			$this->_cc = $this->_bcc = array();
+			$adminEmail = Configure::read('Config.adminEmail');
+			foreach ($this->_to as $k => $v) {
+				if ($k === $adminEmail) {
+					continue;
+				}
+				unset($this->_to[$k]);
+				$this->_to[$adminEmail] = $v;
+			}
+			foreach ($this->_cc as $k => $v) {
+				if ($k === $adminEmail) {
+					continue;
+				}
+				unset($this->_cc[$k]);
+				$this->_cc[$adminEmail] = $v;
+			}
+			foreach ($this->_bcc as $k => $v) {
+				if ($k === $adminEmail) {
+					continue;
+				}
+				unset($this->_bcc[$k]);
+				$this->_bcc[] = $v;
+			}
 		}
 
 		try {