How can errors related to adding multiple attachments in PHPMailer be resolved effectively?

Issue: Errors related to adding multiple attachments in PHPMailer can be resolved by properly iterating through the array of attachments and adding each one individually using the `addAttachment()` method.

// Example code to add multiple attachments in PHPMailer

// Initialize PHPMailer
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

$mail = new PHPMailer(true);

// Add multiple attachments
$attachments = array('file1.pdf', 'file2.jpg', 'file3.txt');

foreach ($attachments as $attachment) {
    $mail->addAttachment('/path/to/attachments/' . $attachment);
}

// Send email
$mail->send();