What are the necessary steps to add file attachments to an email sent using PHP-Mailer?

To add file attachments to an email sent using PHP-Mailer, you need to use the `addAttachment()` method provided by PHP-Mailer. This method allows you to specify the file path, name, and MIME type of the attachment you want to include in the email. By using this method, you can easily attach files such as images, documents, or any other type of file to your email.

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

// Create a new PHPMailer instance
$mail = new PHPMailer();

// Attach a file to the email
$mail->addAttachment('path/to/file.pdf', 'filename.pdf', 'base64', 'application/pdf');

// Rest of the code to set up and send the email