Attach cc in mail using phpmailer

To attach a CC (Carbon Copy) in a mail using PHPMailer, you can use the addCC method. Here's an example:

<?php
require_once 'PHPMailer/PHPMailer.php';
require_once 'PHPMailer/SMTP.php';

$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'your_password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;

$mail->setFrom('[email protected]', 'From Name');
$mail->addAddress('[email protected]', 'To Name'); // Add a recipient
$mail->addCC('[email protected]', 'CC Name'); // Add a CC recipient

$mail->Subject = 'Test email with CC';
$mail->Body = 'This is a test email with CC';

$mail->send();
?>

In this example, we're using the addCC method to add a CC recipient ([email protected]) with a name (CC Name) to the email.

You can also add multiple CC recipients by calling the addCC method multiple times:

$mail->addCC('[email protected]', 'CC1 Name');
$mail->addCC('[email protected]', 'CC2 Name');

Make sure to replace the placeholders ([email protected], your_password, [email protected], [email protected], [email protected], etc.) with your actual email credentials and addresses.