5-Minute Quickstart
This quickstart sends an Aegean Voyages (aegeanvoyages.example) charter option confirmation based on site/modules/WireMailPHPMailer/examples/real-world/charter-confirmation-mail.php.
Send Your First Transactional Email
Section titled “Send Your First Transactional Email”-
Instantiate a fresh
WireMailmessage:<?php declare(strict_types=1);namespace ProcessWire;$mailer = $wire->mail->new(); -
Add recipients (
to,cc,bcc), subject, text, HTML, and attachment:$itineraryPdf = $wire->config->paths->assets . 'brochures/aegean-horizon-gocek.pdf';$mailer->subject('Charter Option Confirmed: M/Y Aegean Horizon (Gocek)')->body("Your 7-night option hold from Gocek Marina is confirmed.\nPlease review the attached itinerary.")->bodyHTML('<p>Your 7-night option hold from <strong>Gocek Marina</strong> is confirmed.</p>');if (is_file($itineraryPdf) && !is_link($itineraryPdf)) {$mailer->attachment($itineraryPdf, 'Aegean-Horizon-Itinerary.pdf');} -
Send and check the delivered recipient count:
$sentCount = $mailer->send();if ($sentCount === 0) {$wire->log->save('mail-errors', 'Failed to deliver charter confirmation email.');}