I use Laravel 5.3
My controller like this :
auth()->user()->notify(new ConfirmOrder($invoice));
My notification like this :
<?php
...
class ConfirmOrder extends Notification implements ShouldQueue, ShouldBroadcast
{
use Queueable;
private $data;
public function __construct($data)
{
$this->data = $data;
}
public function via($notifiable)
{
return ['mail'];
}
public function toMail($notifiable)
{
$mail_myshop = explode(',', config('app.mail_myshop'));
return (new ConfirmOrderMail($this->data, $notifiable))
->to($notifiable->routeNotificationFor('mail'))
->bcc($mail_myshop)
->subject('Thanks');
}
}
My mailable like this :
<?php
...
class ConfirmOrderMail extends Mailable
{
use Queueable, SerializesModels;
public $data;
public $user;
public function __construct($data, $user)
{
$this->data = $data;
$this->user = $user;
}
public function build()
{
return $this->view('vendor.notifications.mail.email-confirm-order',['data'=>$this->data, 'name' => $this->user->name]);
}
}
I combine notification and mailable, because laravel 5.3 not support bcc
It works, but there is one shortcoming. There is no bcc on the email sender. For example, there are 3 emails of bcc. It should appear in the sender's email (If I click sent mail on the gmail and click the detail, Should there exist email bcc. But there is no email bcc)
I setting my sender email in env like this :
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=****@gmail.com
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls
How can I display bcc on the sender email(on the sent mail)?
Update :
I will add details of my problem
If I sending the mail through gmail like this :
Then I check on sent mail menu on gmail from email sender, the result like this :
There looks like bcc email
If I sending the mail from Laravel with my code above, the result :
I check on the sent mail menu from email sender, the result like this :
There looks like no email bcc
What I want is: I want to display bcc email on the sender's email on laravel
How can I do it?