How to set CC And BCC Email Address In Laravel Mail?
Hey Folks,
This example is focused on how to add cc in laravel mail. if you want to see an example of how to add bcc in laravel mail then you are in the right place. you can understand a concept of how to add more cc in email. Here you will learn laravel mail send multiple cc. Here, Create a basic example of laravel mail send multiple bcc.
You can use these tips with laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11 versions.
If you want to add cc or bcc recipient emails in laravel mail then it's very easy. Laravel Mail provides cc() and bcc() method to send more recipient emails for sending emails. so let's see the following solution.
Send Email Code:
You can follow the below tutorial to sending email from laravel. Then the below code i will show you how to send cc and bcc emails.
Follow Mail Sending Tutorial: Laravel Mail | Laravel Send Email Tutorial
.
Send Email with cc and bcc:
You need to update the following controller code:
app/Http/Controllers/MailController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Mail;
use App\Mail\DemoMail;
class MailController extends Controller
{
/**
* Write code on Method
*
* @return response()
*/
public function index()
{
$mailData = [
'title' => 'Mail from ItSolutionStuff.com',
'body' => 'This is for testing email using smtp.'
];
$ccEmails = ["demo@gmail.com", "demo2@gmail.com"];
$bccEmails = ["demo3@gmail.com", "demo4@gmail.com"];
Mail::to('your_email@gmail.com')
->cc($ccEmails)
->bcc($bccEmails)
->send(new DemoMail($mailData));
dd("Email is sent successfully.");
}
}
Now, you can check and you will find the following result:
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Laravel 9 Markdown | Laravel 9 Send Email using Markdown Mailables
- Laravel 9 Mail | Laravel 9 Send Email Tutorial
- Laravel - How to Set Subject in Mail?
- How to Change From Name in Laravel Mail?
- How to Send Mail using Sendinblue in Laravel?
- How to Send Mail using Mailjet in Laravel?
- Laravel Send Mail using Mailgun Example
- How to Send Mail using Queue in Laravel?
- Laravel Mailchimp API Integration Example
- How to Send Mail using Sendgrid in Laravel?
- How to Send Mail in PHP Laravel?
- Laravel Mailgun Setup Example
- How to Send Mail using Gmail SMTP in Laravel?