How to set CC And BCC Email Address In Laravel Mail?

Hello dev, Today we are going to learn How to set CC And BCC Email Address In Laravel Mail? This tutorial will cover on set CC And BCC Email Address In Laravel Mail.

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.

Also Read: How to send mail using Gmail in Laravel 9?

You can use these tips with laravel 6, laravel 7, laravel 8 and laravel 9 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.

Also Read: How to Send Email using PHPMailer in Laravel 9

Example to set CC And BCC Email Address In Laravel Mail

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 LaravelTuts.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.");
    }
}

Conclusion

Today, We had learn How to set CC And BCC Email Address In Laravel Mail? Hope this tutorial helped you with learning Laravel 9. If you have any question you can ask us at comment section below. If you like the tutorial please subscribe our YouTube Channel and follow us on social network Facebook and Instagram.

Also Read: How to Check Running Laravel App Environment?

1 Comment

Leave a Reply