mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
removing duplicate code, config() already applies configs now
This commit is contained in:
parent
138aae670a
commit
0b8a3069eb
1 changed files with 4 additions and 19 deletions
|
@ -553,7 +553,7 @@ class CakeEmail {
|
||||||
* Add header for the message
|
* Add header for the message
|
||||||
*
|
*
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @return mixed $this
|
* @return object $this
|
||||||
* @throws SocketException
|
* @throws SocketException
|
||||||
*/
|
*/
|
||||||
public function addHeaders($headers) {
|
public function addHeaders($headers) {
|
||||||
|
@ -914,28 +914,13 @@ class CakeEmail {
|
||||||
*/
|
*/
|
||||||
public function send($content = null) {
|
public function send($content = null) {
|
||||||
if (is_string($this->_config)) {
|
if (is_string($this->_config)) {
|
||||||
if (!config('email')) {
|
$this->config($this->_config);
|
||||||
throw new SocketException(__d('cake', '%s not found.', APP . 'Config' . DS . 'email.php'));
|
|
||||||
}
|
}
|
||||||
$configs = new EmailConfig();
|
|
||||||
if (!isset($configs->{$this->_config})) {
|
|
||||||
throw new SocketException(__d('cake', 'Unknown email configuration "%s".', $this->_config));
|
|
||||||
}
|
|
||||||
$config = $configs->{$this->_config};
|
|
||||||
if (isset($config['transport'])) {
|
|
||||||
$this->transport($config['transport']);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$config = $this->_config;
|
$config = $this->_config;
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($this->_from)) {
|
if (empty($this->_from)) {
|
||||||
if (!empty($config['from'])) {
|
|
||||||
$this->from($config['from']);
|
|
||||||
} else {
|
|
||||||
throw new SocketException(__d('cake', 'From is not specified.'));
|
throw new SocketException(__d('cake', 'From is not specified.'));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (empty($this->_to) && empty($this->_cc) && empty($this->_bcc)) {
|
if (empty($this->_to) && empty($this->_cc) && empty($this->_bcc)) {
|
||||||
throw new SocketException(__d('cake', 'You need specify one destination on to, cc or bcc.'));
|
throw new SocketException(__d('cake', 'You need specify one destination on to, cc or bcc.'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue