Send HTML and Plain-Text Email in One Message

Last updated: August 28, 2026.

A multipart message lets capable clients display HTML while other clients and accessibility tools receive a clean text alternative. Both parts should contain the same essential information.

Set both message bodies

<?php
require __DIR__ . '/vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
$mail = new PHPMailer(true);
// Configure SMTP, sender, and recipient first.
$mail->isHTML(true);
$mail->Subject = 'Weekly summary';
$mail->Body = '<h1>Weekly summary</h1><p>Your report is <a href="https://example.com/report">ready</a>.</p>';
$mail->AltBody = "Weekly summary\n\nYour report is ready: https://example.com/report";
$mail->send();

Keep email HTML conservative

  • Use meaningful link text.
  • Escape all user-provided values.
  • Include useful alt text for images.
  • Test several major mail clients.

Reference: PHPMailer official repository.

admin

admin