How can multiple recipients be added to an email using PHPMailer or a similar library in PHP?
To add multiple recipients to an email using PHPMailer or a similar library in PHP, you can simply call the `addAddress()` method for each recipient email address. This method allows you to specify the email address and optional recipient name for each recipient.
// Create a new PHPMailer instance
$mail = new PHPMailer();
// Add multiple recipients
$mail->addAddress('recipient1@example.com', 'Recipient 1');
$mail->addAddress('recipient2@example.com', 'Recipient 2');
$mail->addAddress('recipient3@example.com', 'Recipient 3');
// Send the email
if ($mail->send()) {
echo 'Email sent successfully';
} else {
echo 'Email could not be sent';
}