ソースを参照

keep the name

euromark 11 年 前
コミット
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
 		// Security measure to not sent to the actual addressee in debug mode
 		if (Configure::read('debug')) {
 		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 {
 		try {