dimanche 6 décembre 2020

Email send in laravel to CC users multiple times

I have send email form in laravel and have three fields like below

enter image description here

Now the problem is that if I select multiple users in To then in CC user getting email two time. And if I select three emails then CC users getting email three times.

Is there any solution to send email only one time.

Below is the laravel email code.

Controller

        $users = User::whereIn('id', $request->recipients)->get();
    
        $users_cc = [];

        if ($request->recipients_cc)
            $users_cc = User::whereIn('id', $request->recipients_cc)->get()->pluck('email');

        Notification::send($users, new IncidentSendEmail($request->note, $users_cc));

Event Code:

   public function toMail($notifiable)
    {


        return (new MailMessage)
            ->from(request()->user()->email, request()->user()->name)
            ->cc($this->recipients_cc)
            ->line($this->note)
            ->line('Thank you for using our application!');
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire