Backend\Modules\Profiles\Engine\Model::sendMail PHP Method

sendMail() protected static method

Send mail
protected static sendMail ( string $subject, string $templatePath = null, array $variables, string $toEmail, string $toDisplayName = null )
$subject string
$templatePath string
$variables array
$toEmail string
$toDisplayName string
    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);
    }