Reputation: 4133
I am using the default Laravel Mail
class to send emails.
I am trying to add bcc to myself, but when I add a bcc the email is not send at all.
Here is my code:
Mail::send(
'emails.order.order',
array(
'dateTime' => $dateTime,
'items' => $items
),
function($message) use ($toEmail, $toName) {
$message->from('[email protected]', 'My Company');
$message->to($toEmail, $toName);
$message->bcc('[email protected]');
$message->subject('New order');
}
);
Upvotes: 21
Views: 44870
Reputation: 41
In my case I solved just adding the 'bcc' after 'to', without name, just with email address.
->to($email)
->bcc($other_email)
->send(new YourMailHere);
Upvotes: 0
Reputation: 2067
As Ivan Dokov said, you need to pass the email and name to the bcc function. You could also shorten your code by doing this
function($message) use ($toEmail, $toName) {
$message->from('[email protected]', 'My Company')
->to($toEmail, $toName)
->bcc('[email protected]','My bcc Name')
->subject('New order');
}
Upvotes: 3
Reputation: 4133
I have found the problem.
I didn't use the correct parameters for $message->bcc('[email protected]');
I had to write email AND name: $message->bcc('[email protected]', 'My Name');
The same way as I use $message->to($toEmail, $toName);
Upvotes: 41