MailSuite Pro documentation

Sending mail using PHP API

The following sample code allows for sending mail out using PHP API of MailSuite Pro.

$sEmail = "";
$sTo = "";
$sSubject = "Message subject";
$sBody = "<b>This is <i>my</i> message</b>";
$bHTML = true;
include './system/autoload.php';
$oCoreModule = \Aurora\System\Api::GetModule("Core");
$oMailModule = \Aurora\System\Api::GetModule("Mail");
$oAccount = $oCoreModule->GetAccountUsedToAuthorize($sEmail);
try {
    $oMailModule->SendMessage($oAccount->EntityId, null, null, 0, [], "", $sTo, "", "", [], $sSubject, $sBody, $bHTML);
    echo "Message sent successfully";
catch(Exception $e)
    echo "Message could not be sent";

If you need to send a plaintext email message, set $bHTML to false; if you're sending HTML email, its plaintext part will be built from HTML automatically.