This demonstrates sending out one email messages with binary attachments with multipart/alternative support with Exception Handling.
With the exception of SMTP examples, PHPMailer Pro will automatically detect the MTA (Mail Transfer Agent). There is no requirement to add properties for IsQmail, IsSendmail, or IsMail. The properties are deprecated and removed.
<?php
require('assets/phpmailer2/PHPMailer Pro.php');
$mail = new codeworxtech\PHPMailer Pro();
try {
$mail->SetSender( ["name@yourdomain.com" => "First Last" ] );
$mail->AddRecipient( ["whoto@otherdomain.com" => "John Doe" ] );
$mail->AddBCC( ["whogetsBCC@yourdomain.com" => "First Last" ] );
$mail->Subject = "PHPMailer Pro Test Subject via sendmail, advanced";
$mail->MessageHTML = $_SERVER['DOCUMENT_ROOT'] . "/phpmailer2/data/contents.html";
$mail->MessageText = "To view the message, please use an HTML compatible email viewer!";
$mail->AddAttachment($_SERVER['DOCUMENT_ROOT'] . "/phpmailer2/data/phpmailer2.gif");
$mail->AddAttachment($_SERVER['DOCUMENT_ROOT'] . "/phpmailer2/data/phpmailer2_mini.gif");
} catch (Exception $e) {
echo $e->errorMessage();
}
?>
Download example