Closed mtpultz closed 7 years ago
If you set to array the bcc
attribute will be used, but yeah there's no cc
.
However you can use a Mailable instead:
public function toMail($notifiable)
{
return (new \App\Mail\OrderShipped($this->order))->to($notifiable->routeNotificationFor('mail'))->cc(...);
}
Nice, I didn't know you could use Mailables in Notifications they seem to be documented as two different services so I assumed I would be customizing the MailMessage class, and overwriting the MailChannel. This isn't even mentioned in the Laracast videos, which also make it sound like they are separate entities.
Thanks @themsaid
It was added a few days ago, guess no one PRed a doc update :)
I noticed you focused on the existence of Bcc, but I also mentioned I noticed if it was an array it would Bcc all recipients. In some cases you don't want to Bcc everyone.
Well I think it's just a convenient, you can always use a Mailable which will give you more flexibility.
Thanks @themsaid will do :)
FYI
cc and bcc are in MailMessage since laravel v5.3.22 (2016-11-01)
@minkbear cc yes, but bcc not
@iangcarroll OH yes, you are right.
Hm, I don't see anything like this in Laravel 5.4, MailMessage and SimpleMessage don't have either "to", "cc" or "bcc" methods.
Hi guys!
Maybe just a hotfix, until the notification uses some config value for bcc recipients. Easiest way I think will be to set up an EventListener. Something like that
namespace Tenmedia\Example\Listeners;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class MessageSendingListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param MessageSending $event
* @return void
*/
public function handle(MessageSending $event)
{
$event->message->addBcc('bcc@example.com');
}
}
Description:
Notification emails though you can set
to
to be an array of email addresses MailMessage is missingcc
. I can see in MailChannel thatbcc
exists if multiple recipients, but it would be nice to allow for direct whitelisting and blacklisting directly instead of it being assumed. In some cases you would want to have each individual mailed with each of the recipients known.Steps To Reproduce:
N/A