How can the PHPMailer library be utilized to send multipart/alternative emails with images and links?

To send multipart/alternative emails with images and links using the PHPMailer library, you can create a HTML email with both plain text and HTML content. You can embed images using the `addEmbeddedImage()` method and include links in the HTML content. This way, recipients with email clients that do not support HTML will still be able to view the plain text version of the email.

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

require 'vendor/autoload.php';

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

try {
    //Server settings
    $mail->isSMTP();
    $mail->Host = 'smtp.example.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'your@example.com';
    $mail->Password = 'yourpassword';
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
    $mail->Port = 587;

    //Recipients
    $mail->setFrom('from@example.com', 'Your Name');
    $mail->addAddress('recipient@example.com', 'Recipient Name');

    //Content
    $mail->isHTML(true);
    $mail->Subject = 'Subject';
    $mail->Body = '<p>This is the HTML message body with an image: <img src="cid:logo"></p>';
    $mail->AltBody = 'This is the plain text message body';

    // Attach image
    $mail->addEmbeddedImage('path/to/image.jpg', 'logo');

    $mail->send();
    echo 'Email has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>