/**
  * sendHtml
  *
  * @param string $from default value empty
  * @param string $target default value empty
  * @param string $cc default value empty
  * @param string $bcc default value empty
  * @param string $subject default value empty
  * @param array $Fields
  * @param string $content default value empty
  * @param array $attachs default value empty
  * @param string $plainText default false
  * @param boolean $returnContent default value false
  *
  * @return object $result
  */
 function sendHtml($from = "", $target = "", $cc = "", $bcc = "", $subject = "", $Fields = array(), $content = "", $attachs = array(), $plainText = false, $returnContent = false)
 {
     //Replace the @@Fields with the $Fields array.
     $content = mailer::replaceFields($Fields, $content);
     //Create the alternative body (text only)
     //$h2t =& new html2text($content);
     $text = '';
     //$h2t->get_text();
     //Prepate el phpmailer
     $mailer = mailer::instanceMailer();
     $arpa = mailer::arpaEMAIL($from);
     $mailer->From = $arpa['email'] == '' ? $mailer->defaultEMail : $arpa['email'];
     $mailer->FromName = $arpa['name'];
     $arpa = mailer::arpaEMAIL($target);
     $mailer->AddAddress($arpa['email'], $arpa['name']);
     $mailer->AddCC($cc);
     $mailer->AddBCC($bcc);
     $mailer->Subject = $subject;
     if ($plainText) {
         $content = $text;
     }
     if ($content === '') {
         $content = 'empty';
     }
     $mailer->Body = $content;
     //$mailer->AltBody = $text;
     $mailer->isHTML(!$plainText);
     //Attach the required files
     if (is_array($attachs)) {
         if (sizeof($attachs) > 0) {
             foreach ($attachs as $aFile) {
                 $mailer->AddAttachment($aFile, basename($aFile));
             }
         }
     }
     //Send the e-mail.
     for ($r = 1; $r <= 4; $r++) {
         $result = $mailer->Send();
         if ($result) {
             break;
         }
     }
     //unset($h2t);
     if ($result && $returnContent) {
         return $content;
     }
     return $result;
 }