Skip to content

Commit

Permalink
Merge pull request #16705 from MrAtiebatie/5.3
Browse files Browse the repository at this point in the history
Apply global to email addres to CC and BCC
  • Loading branch information
taylorotwell authored Dec 8, 2016
2 parents 6b413d5 + 0ddd42a commit 49b8da4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public function send($view, array $data = [], $callback = null)

if (isset($this->to['address'])) {
$message->to($this->to['address'], $this->to['name'], true);
$message->cc($this->to['address'], $this->to['name'], true);
$message->bcc($this->to['address'], $this->to['name'], true);
}

$message = $message->getSwiftMessage();
Expand Down
18 changes: 16 additions & 2 deletions src/Illuminate/Mail/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ public function to($address, $name = null, $override = false)
*
* @param string|array $address
* @param string|null $name
* @param bool $override
* @return $this
*/
public function cc($address, $name = null)
public function cc($address, $name = null, $override = false)
{
if ($override) {
$this->swift->setCc($address, $name);

return $this;
}

return $this->addAddresses($address, $name, 'Cc');
}

Expand All @@ -102,10 +109,17 @@ public function cc($address, $name = null)
*
* @param string|array $address
* @param string|null $name
* @param bool $override
* @return $this
*/
public function bcc($address, $name = null)
public function bcc($address, $name = null, $override = false)
{
if ($override) {
$this->swift->setBcc($address, $name);

return $this;
}

return $this->addAddresses($address, $name, 'Bcc');
}

Expand Down

0 comments on commit 49b8da4

Please sign in to comment.