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');
}
);
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);
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');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With