protected static function sendMail($subject, $templatePath = null, $variables, $toEmail, $toDisplayName = null)
{
if (empty($templatePath)) {
$templatePath = FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.html.twig';
}
// define variables
$from = BackendModel::get('fork.settings')->get('Core', 'mailer_from');
$replyTo = BackendModel::get('fork.settings')->get('Core', 'mailer_reply_to');
// create a message object and set all the needed properties
$message = Message::newInstance($subject)->setFrom(array($from['email'] => $from['name']))->setTo(array($toEmail => $toDisplayName))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml($templatePath, $variables, true);
// send it through the mailer service
BackendModel::get('mailer')->send($message);
}