public function sendMail($recipient, $subject, $htmlBody, $textBody = false)
    {
        $message = \Swift_Message::newInstance();
    
        // Subject
        $message->setSubject($subject);
    
        // From
        $fromEmail = $this->configurationManager->getSetting('mailer.sendFrom');
        $fromName = $this->configurationManager->getSetting('mailer.sendFromName');
        $message->setFrom(array($fromEmail => $fromName));
    
        // To
        $message->setTo($recipient);
    
        // HTML body
        $message->setBody($htmlBody, 'text/html');
        
        // Text body
        if ($textBody === false) {
            $textBody = $this->createTextBody($htmlBody);
        }
        $message->addPart($textBody, 'text/plain');
    
        $mailer = $this->getMailer();
        return $mailer->send($message);
    }