How can the PEAR Mail Package be effectively used to send emails with multiple recipient addresses in PHP?

To send emails with multiple recipient addresses using the PEAR Mail Package in PHP, you can simply pass an array of email addresses to the 'send' method of the Mail object. This allows you to send the same email to multiple recipients at once.

<?php
require_once "Mail.php";

$recipients = array("recipient1@example.com", "recipient2@example.com", "recipient3@example.com");
$from = "sender@example.com";
$subject = "Test Email";
$body = "This is a test email sent to multiple recipients.";

$headers = array(
    'From' => $from,
    'To' => implode(',', $recipients),
    'Subject' => $subject
);

$mail = Mail::factory('smtp', array(
    'host' => 'smtp.example.com',
    'port' => 25,
    'auth' => true,
    'username' => 'username',
    'password' => 'password'
));

$mail->send($recipients, $headers, $body);
?>