コード例 #1
0
 /**
  *
  * @param string $from
  * @param string $fromname
  * @param string $email
  * @param string $subject
  * @param string $body
  * @param boolean $htmlMode
  * @return boolean
  */
 static function sendMail($from, $fromname, $email, $subject, $body, $htmlMode)
 {
     $attachments = null;
     if (!$htmlMode) {
         $body = BookProHelper::html2text($body);
     }
     if (is_array($froms = explode(',', str_replace(';', ',', $from))) && count($froms)) {
         $from = reset($froms);
     } else {
         $mainframe =& JFactory::getApplication();
         /* @var $mainframe JApplication */
         $from = $mainframe->getCfg('mailfrom');
     }
     if (is_array($emails = explode(',', str_replace(';', ',', $email)))) {
         $mail = JFactory::getMailer();
         /* @var $mail JMail */
         foreach ($emails as $email) {
             $mail->sendMail($from, $fromname, $email, $subject, $body, $htmlMode, null, null, $attachments);
         }
     }
 }