What are common issues when using the PEAR Mail_Mime class to add multiple attachments in PHP?

Common issues when using the PEAR Mail_Mime class to add multiple attachments in PHP include incorrect file paths, improper MIME types, and encoding errors. To solve these issues, make sure to provide the correct file paths for each attachment, specify the correct MIME types for each file, and ensure that the attachments are properly encoded before adding them to the Mail_Mime object.

// Create a new Mail_Mime object
$mail_mime = new Mail_mime();

// Add multiple attachments with correct file paths, MIME types, and encoding
$mail_mime->addAttachment('/path/to/file1.pdf', 'application/pdf');
$mail_mime->addAttachment('/path/to/file2.jpg', 'image/jpeg');

// Build the email message with attachments
$body = 'Email body with attachments';
$headers = array(
    'From' => 'sender@example.com',
    'Subject' => 'Email with attachments'
);
$body = $mail_mime->get();
$headers = $mail_mime->headers($headers);

// Send the email using Mail package
$mail = Mail::factory('smtp', $smtp_params);
$mail->send('recipient@example.com', $headers, $body);