Sending mail using PHP API
The following sample code allows for sending mail out using PHP API of MailSuite Pro.
<?php
$sEmail = "user@domain.com";
$sTo = "recipient@server.com";
$sSubject = "Message subject";
$sBody = "<b>This is <i>my</i> message</b>";
$bHTML = true;
include './system/autoload.php';
\Aurora\System\Api::Init(true);
$oCoreDecorator = \Aurora\Modules\Core\Module::Decorator();
$oMailDecorator = \Aurora\Modules\Mail\Module::Decorator();
$oAccount = $oCoreDecorator->GetAccountUsedToAuthorize($sEmail);
try {
$oMailDecorator->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.