示例#1
0
 public function Process()
 {
     $copy_to_submitter = (bool) JRequest::getVar($this->SafeName("copy_to_submitter" . $this->GetId()), NULL, 'POST') || $this->Params->get("copy_to_submitter", NULL) == 1;
     // always send a copy parameter
     if (!$copy_to_submitter || !isset($this->FieldsBuilder->Fields['sender1']) || empty($this->FieldsBuilder->Fields['sender1']['Value'])) {
         $this->FSession->Clear('filelist');
         //JLog::add("Copy email for the submitter skipped.", JLog::INFO, get_class($this));
         return true;
     }
     $mail = JFactory::getMailer();
     $this->set_from($mail);
     $this->set_to($mail);
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
     // Body
     $body = $this->Params->get("email_copy_text", "") . PHP_EOL;
     // a blank line
     $body .= PHP_EOL;
     if ($this->Params->get("email_copy_summary", NULL)) {
         $body .= $this->body();
         $body .= $this->attachments();
         $body .= PHP_EOL;
     }
     // A null body will raise a mail error, so always add at least a signature.
     $body .= "------" . PHP_EOL . $this->Application->getCfg("sitename") . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     // Clear file list for the next submission of the same users
     $this->FSession->Clear('filelist');
     $this->send($mail);
     return true;
 }
示例#2
0
	/**
	 * @group	framework.mail
	 * @dataProvider	getCleanSubjectData
	 */
	public function testCleanSubject( $input, $expected )
	{
		$this->assertThat(
			JMailHelper::cleanSubject( $input ),
			$this->equalTo( $expected )
		);
	}
示例#3
0
 public function Process()
 {
     $copy_to_submitter = (bool) JRequest::getVar($this->SafeName("copy_to_submitter" . $this->GetId()), NULL, 'POST') || $this->Params->get("copy_to_submitter", NULL) == 1;
     if (!$copy_to_submitter || !isset($this->FieldsBuilder->senderEmail->b2jFieldValue) || empty($this->FieldsBuilder->senderEmail->b2jFieldValue)) {
         $this->B2JSession->Clear('filelist');
         return true;
     }
     $mail = JFactory::getMailer();
     $mail->isHTML(true);
     $this->set_from($mail);
     $this->set_to($mail);
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
     $body = $this->Params->get("email_copy_text", "") . PHP_EOL;
     $body .= PHP_EOL;
     if ($this->Params->get("email_copy_summary", NULL)) {
         $body .= $this->body();
         $body .= PHP_EOL;
         $body .= $this->attachments();
         $body .= PHP_EOL;
     }
     $body .= "------" . PHP_EOL . $this->Application->getCfg("sitename") . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     $this->B2JSession->Clear('filelist');
     $this->send($mail);
     return true;
 }
 private function sendNotificationOnUpdateRank($userinfo, $result)
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     jimport('joomla.mail.helper');
     require_once JPATH_ROOT . '/components/com_alphauserpoints/helper.php';
     // get params definitions
     $params = JComponentHelper::getParams('com_alphauserpoints');
     $jsNotification = $params->get('jsNotification', 0);
     $jsNotificationAdmin = $params->get('fromIdUddeim', 0);
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $sef = $app->getCfg('sef');
     $email = $userinfo->email;
     $subject = $result->emailsubject;
     $body = $result->emailbody;
     $formatMail = $result->emailformat;
     $bcc2admin = $result->bcc2admin;
     $subject = str_replace('{username}', $userinfo->username, $subject);
     $subject = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $subject);
     $body = str_replace('{username}', $userinfo->username, $body);
     $body = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $body);
     $subject = JMailHelper::cleanSubject($subject);
     if (!$jsNotification) {
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($MailFrom, $FromName));
         $mailer->setSubject($subject);
         $mailer->isHTML((bool) $formatMail);
         $mailer->CharSet = "utf-8";
         $mailer->setBody($body);
         $mailer->addRecipient($email);
         if ($bcc2admin) {
             // get all users allowed to receive e-mail system
             $query = "SELECT email" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
             $db->setQuery($query);
             $rowsAdmins = $db->loadObjectList();
             foreach ($rowsAdmins as $rowsAdmin) {
                 $mailer->addBCC($rowsAdmin->email);
             }
         }
         $send = $mailer->Send();
     } else {
         require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
         $params = new CParameter('');
         CNotificationLibrary::add('system_messaging', $jsNotificationAdmin, $userinfo->id, $subject, $body, '', $params);
         if ($bcc2admin) {
             // get all users allowed to receive e-mail system
             $query = "SELECT id" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
             $db->setQuery($query);
             $rowsAdmins = $db->loadObjectList();
             foreach ($rowsAdmins as $rowsAdmin) {
                 $mailer->addBCC($rowsAdmin->id);
                 CNotificationLibrary::add('system_messaging', $userinfo->id, $rowsAdmin->id, $subject, $body, '', $params);
             }
         }
     }
 }
示例#5
0
 public function Process()
 {
     $mail = JFactory::getMailer();
     $this->set_from($mail);
     $this->set_to($mail, "to_address", "addRecipient");
     $this->set_to($mail, "cc_address", "addCC");
     $this->set_to($mail, "bcc_address", "addBCC");
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_subject", "")));
     $body = $this->body();
     $body .= $this->attachments($mail);
     $body .= PHP_EOL;
     $body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
     $body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     $this->Logger->Write("---------------------------------------------------" . PHP_EOL . $body);
     return $this->send($mail);
 }
 public function Process()
 {
     $application = JFactory::getApplication();
     $copy_to_submitter = $application->input->post->get($this->SafeName("copy_to_submitter" . $this->GetId()), false, "bool") || $this->Params->get("copy_to_submitter", null) == 1;
     // always send a copy parameter
     if (!$copy_to_submitter || !isset($this->FieldsBuilder->Fields['sender1']) || empty($this->FieldsBuilder->Fields['sender1']['Value'])) {
         $this->session->clear("filelist", $this->namespace);
         //JLog::add("Copy email for the submitter skipped.", JLog::INFO, get_class($this));
         return true;
     }
     $mail = JFactory::getMailer();
     $this->set_from($mail);
     $this->set_to($mail);
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
     // Body
     $body = $this->Params->get("email_copy_text", "") . PHP_EOL;
     // a blank line
     $body .= PHP_EOL;
     if ($this->Params->get("email_copy_summary", null)) {
         $body .= $this->body();
         $body .= $this->attachments();
         $body .= PHP_EOL;
     }
     // A null body will raise a mail error, so always add at least a signature.
     $body .= "------" . PHP_EOL . JFactory::getConfig()->get("sitename") . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     // Clear file list for the next submission of the same users
     $this->session->clear("filelist", $this->namespace);
     $sent = $this->send($mail);
     if ($sent) {
         // Notify email send success
         $this->Logger->Write("Copy email sent.");
     }
     return $sent;
 }
 protected function _sendReportToMail($message, $subject, $emailToList)
 {
     jimport('joomla.mail.helper');
     $sender = JMailHelper::cleanAddress($this->config->board_title . ' ' . JText::_('COM_KUNENA_GEN_FORUM') . ': ' . $this->_getSenderName());
     $subject = JMailHelper::cleanSubject($subject);
     $message = JMailHelper::cleanBody($message);
     foreach ($emailToList as $emailTo) {
         if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
             continue;
         }
         JUtility::sendMail($this->config->email, $sender, $emailTo->email, $subject, $message);
     }
     $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_SUCCESS'));
     while (@ob_end_clean()) {
     }
     $this->app->redirect(CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, NULL, NULL, $this->id, false));
 }
示例#8
0
 function sendEmailToModeratorsPostWFM()
 {
     // get settings from com_discussions parameters
     $params = JComponentHelper::getParams('com_discussions');
     $SiteName = $params->get('emailSiteName', '');
     $from = $params->get('emailFrom', '');
     $sender = $params->get('emailSender', '');
     $link = $params->get('emailLink', '');
     $subject = $params->get('emailWFMSubject', '');
     $msgparam = $params->get('emailWFMMessage', '');
     jimport('joomla.mail.helper');
     $db =& JFactory::getDBO();
     // get all moderators with email notifications set
     $sql = "SELECT u.username, u.email FROM " . $db->nameQuote('#__users') . " u, " . $db->nameQuote('#__discussions_users') . " d" . " WHERE u.id = d.id AND d.moderator = 1 AND d.email_notification = 1";
     $db->setQuery($sql);
     $_moderator_list = $db->loadAssocList();
     reset($_moderator_list);
     while (list($key, $val) = each($_moderator_list)) {
         $username = $_moderator_list[$key]['username'];
         $email = $_moderator_list[$key]['email'];
         if (JMailHelper::isEmailAddress($email)) {
             // construct email
             $msg = $username . ", \n\n" . $msgparam;
             $body = sprintf($msg, $SiteName, $sender, $from, $link);
             // Clean the email data
             $subject = JMailHelper::cleanSubject($subject);
             $body = JMailHelper::cleanBody($body);
             $sender = JMailHelper::cleanAddress($sender);
             JUtility::sendMail($from, $sender, $email, $subject, $body);
         }
     }
     return 0;
 }
示例#9
0
 /**
  * Send email with download (file) link, to the given email address
  *
  * @access public
  * @since 1.0
  */
 function share_file_email()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $document = JFactory::getDocument();
     $timeout = $session->get('com_flexicontent.formtime', 0);
     if ($timeout == 0 || time() - $timeout < 2) {
         JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
         return $this->share_file_form();
     }
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $file_id = (int) JRequest::getInt('file_id', 0);
     $content_id = (int) JRequest::getInt('content_id', 0);
     $field_id = (int) JRequest::getInt('field_id', 0);
     $tpl = JRequest::getCmd('$tpl', 'default');
     // Check for missing file id
     if (!$file_id) {
         jexit(JText::_('file id is missing'));
     }
     // Check file exists
     $query = ' SELECT * FROM #__flexicontent_files WHERE id=' . $file_id;
     $db->setQuery($query);
     $file = $db->loadObject();
     if ($db->getErrorNum()) {
         jexit(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()));
     }
     if (!$file) {
         jexit(JText::_('file id no ' . $file_id . ', was not found'));
     }
     // Create SELECT OR JOIN / AND clauses for checking Access
     $access_clauses['select'] = '';
     $access_clauses['join'] = '';
     $access_clauses['and'] = '';
     $access_clauses = $this->_createFieldItemAccessClause($get_select_access = false, $include_file = true);
     // Get field's configuration
     $q = 'SELECT attribs, name FROM #__flexicontent_fields WHERE id = ' . (int) $field_id;
     $db->setQuery($q);
     $fld = $db->loadObject();
     $field_params = new JRegistry($fld->attribs);
     // Get all needed data related to the given file
     $query = 'SELECT f.id, f.filename, f.altname, f.secure, f.url,' . ' i.title as item_title, i.introtext as item_introtext, i.fulltext as item_fulltext, u.email as item_owner_email, ' . ' CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as itemslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__flexicontent_fields_item_relations AS rel' . ' LEFT JOIN #__flexicontent_files AS f ON f.id = rel.value' . ' LEFT JOIN #__flexicontent_fields AS fi ON fi.id = rel.field_id' . ' LEFT JOIN #__content AS i ON i.id = rel.item_id' . ' LEFT JOIN #__categories AS c ON c.id = i.catid' . ' LEFT JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' LEFT JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ' LEFT JOIN #__users AS u ON u.id = i.created_by' . $access_clauses['join'] . ' WHERE rel.item_id = ' . $content_id . ' AND rel.field_id = ' . $field_id . ' AND f.id = ' . $file_id . ' AND f.published= 1' . $access_clauses['and'];
     $db->setQuery($query);
     $file = $db->loadObject();
     if ($db->getErrorNum()) {
         jexit(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()));
     }
     if (empty($file)) {
         // this is normally not reachable because the share link should not have been displayed for the user, but it is reachable if e.g. user session has expired
         jexit(JText::_('FLEXI_ALERTNOTAUTH') . "File data not found OR no access for file #: " . $file_id . " of content #: " . $content_id . " in field #: " . $field_id);
     }
     $coupon_vars = '';
     if ($field_params->get('enable_coupons', 0)) {
         // Insert new download coupon into the DB, in the case the file is sent to a user with no ACCESS
         $coupon_token = uniqid();
         // create coupon token
         $query = ' INSERT #__flexicontent_download_coupons ' . 'SET user_id = ' . (int) $user->id . ', file_id = ' . $file_id . ', token = ' . $db->Quote($coupon_token) . ', hits = 0' . ', hits_limit = ' . (int) $field_params->get('coupon_hits_limit', 3) . ', expire_on = NOW() + INTERVAL ' . (int) $field_params->get('coupon_expiration_days', 15) . ' DAY';
         $db->setQuery($query);
         $db->execute();
         $coupon_id = $db->insertid();
         // get id of newly created coupon
         $coupon_vars = '&conid=' . $coupon_id . '&contok=' . $coupon_token;
     }
     $uri = JURI::getInstance();
     $base = $uri->toString(array('scheme', 'host', 'port'));
     $vars = '&id=' . $file_id . '&cid=' . $content_id . '&fid=' . $field_id . $coupon_vars;
     $link = $base . JRoute::_('index.php?option=com_flexicontent&task=download' . $vars, false);
     // Verify that this is a local link
     if (!$link || !JURI::isInternal($link)) {
         //Non-local url...
         JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
         return $this->share_file_form();
     }
     // An array of email headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we find one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos($_POST[$field], $header) !== false) {
                 JError::raiseError(403, '');
             }
         }
     }
     /*
      * Free up memory
      */
     unset($headers, $fields);
     $email = JRequest::getString('mailto', '', 'post');
     echo "<br>";
     $sender = JRequest::getString('sender', '', 'post');
     echo "<br>";
     $from = JRequest::getString('from', '', 'post');
     echo "<br>";
     $_subject = JText::sprintf('FLEXI_FIELD_FILE_SENT_BY', $sender);
     echo "<br>";
     $subject = JRequest::getString('subject', $_subject, 'post');
     echo "<br>";
     $desc = JRequest::getString('desc', '', 'post');
     echo "<br>";
     // Check for a valid to address
     $error = false;
     if (!$email || !JMailHelper::isEmailAddress($email)) {
         $error = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_INVALID', $email);
         JError::raiseWarning(0, $error);
     }
     // Check for a valid from address
     if (!$from || !JMailHelper::isEmailAddress($from)) {
         $error = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_INVALID', $from);
         JError::raiseWarning(0, $error);
     }
     if ($error) {
         return $this->share_file_form();
     }
     // Build the message to send
     $body = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_MSG', $SiteName, $sender, $from, $link);
     $body .= "\n\n" . JText::_('FLEXI_FIELD_FILE_EMAIL_SENDER_NOTES') . ":\n\n" . $desc;
     // Clean the email data
     $subject = JMailHelper::cleanSubject($subject);
     $body = JMailHelper::cleanBody($body);
     $sender = JMailHelper::cleanAddress($sender);
     $html_mode = false;
     $cc = null;
     $bcc = null;
     $attachment = null;
     $replyto = null;
     $replytoname = null;
     // Send the email
     $send_result = JFactory::getMailer()->sendMail($from, $sender, $email, $subject, $body, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
     if ($send_result !== true) {
         JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
         return $this->share_file_form();
     }
     $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH);
     include 'file' . DS . 'share_result.php';
 }
示例#10
0
 if ($list_email_administrator == '') {
     $list_email_administrator = $MailFrom;
 }
 $emails = @explode(',', $list_email_administrator);
 $subject = JText::_('AC_REPORT_THIS_LISTING') . " (" . $SiteName . ")";
 // Build the message to send
 $msg = JText::_('AUP_EMAIL_MSG_INVITE');
 $body = sprintf($msg, $SiteName, $sender, $link) . " \n" . $report;
 $body = JText::_('AC_USER_REPORTED_ARTICLE') . " \n";
 $body .= JText::_('AC_NAME') . ": " . $reportname . " \n";
 $body .= JText::_('AC_EMAIL') . ": " . $reportemail . " \n";
 $body .= JText::_('AC_REPORT') . ": " . $report . " \n";
 $body .= JText::_('AC_COMPONENT') . ": " . $type . " \n";
 $body .= JText::_('AC_ID') . ": " . $id . " \n";
 // Clean the email data
 $subject = JMailHelper::cleanSubject($subject);
 $body = JMailHelper::cleanBody($body);
 foreach ($emails as $email) {
     if (JMailHelper::isEmailAddress($email)) {
         $mailer =& JFactory::getMailer();
         $mailer->setSender(array($MailFrom, $FromName));
         $mailer->setSubject($subject);
         $mailer->setBody($body);
         $mailer->addRecipient($email);
         if ($mailer->Send() === true) {
             $success = true;
         }
     }
 }
 if ($success) {
     echo JText::_('AC_THANKS4UREPORT');
示例#11
0
 /**
  * Send the message and display a notice
  *
  * @access public
  * @since 1.5
  */
 function send()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     $timeout = Session::get('com_mailto.formtime', 0);
     if ($timeout == 0 || time() - $timeout < 20) {
         throw new Exception(Lang::txt('COM_MAILTO_EMAIL_NOT_SENT'), 500);
         return $this->mailto();
     }
     $SiteName = Config::get('sitename');
     $MailFrom = Config::get('mailfrom');
     $FromName = Config::get('fromname');
     $link = MailtoHelper::validateHash(Request::getCMD('link', '', 'post'));
     // Verify that this is a local link
     if (!$link || !JURI::isInternal($link)) {
         //Non-local url...
         throw new Exception(Lang::txt('COM_MAILTO_EMAIL_NOT_SENT'), 500);
         return $this->mailto();
     }
     // An array of email headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we find one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos($_POST[$field], $header) !== false) {
                 App::abort(403, '');
             }
         }
     }
     // Free up memory
     unset($headers, $fields);
     $email = Request::getString('mailto', '', 'post');
     $sender = Request::getString('sender', '', 'post');
     $from = Request::getString('from', '', 'post');
     $subject_default = Lang::txt('COM_MAILTO_SENT_BY', $sender);
     $subject = Request::getString('subject', $subject_default, 'post');
     // Check for a valid to address
     $error = false;
     if (!$email || !JMailHelper::isEmailAddress($email)) {
         $error = Lang::txt('COM_MAILTO_EMAIL_INVALID', $email);
         Notify::warning($error);
     }
     // Check for a valid from address
     if (!$from || !JMailHelper::isEmailAddress($from)) {
         $error = Lang::txt('COM_MAILTO_EMAIL_INVALID', $from);
         Notify::warning($error);
     }
     if ($error) {
         return $this->mailto();
     }
     // Build the message to send
     $msg = Lang::txt('COM_MAILTO_EMAIL_MSG');
     $body = sprintf($msg, $SiteName, $sender, $from, $link);
     // Clean the email data
     $subject = JMailHelper::cleanSubject($subject);
     $body = JMailHelper::cleanBody($body);
     $sender = JMailHelper::cleanAddress($sender);
     // Send the email
     if (JFactory::getMailer()->sendMail($from, $sender, $email, $subject, $body) !== true) {
         throw new Exception(Lang::txt('COM_MAILTO_EMAIL_NOT_SENT'), 500);
         return $this->mailto();
     }
     Request::setVar('view', 'sent');
     $this->display();
 }
示例#12
0
function mail_notification($subscription)
{
    if (in_array(15, $subscription->courses)) {
        jimport('joomla.mail.helper');
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $SiteName = $JLMS_CONFIG->get('sitename');
        $MailFrom = $JLMS_CONFIG->get('mailfrom');
        $FromName = $JLMS_CONFIG->get('fromname');
        JLoader::import('autoresponder_spu', JPATH_SITE, '');
        $subject = AutoResponder::getSubject();
        $body = AutoResponder::getBody();
        $body = sprintf($body);
        $subject = JMailHelper::cleanSubject($subject);
        $body = JMailHelper::cleanBody($body);
        $from = $SiteName . ' ' . $FromName;
        $sender = JMailHelper::cleanAddress($MailFrom);
        $email = JMailHelper::cleanAddress(JRequest::getVar('x_email', ''));
        $user =& JFactory::getUser();
        $name = explode(' ', $user->name);
        $firstname = isset($name[0]) && $name[0] ? $name[0] : $user->name;
        $body = str_replace('{firstname}', $firstname, $body);
        if (JUtility::sendMail($from, $sender, $email, $subject, $body, true) !== true) {
            JError::raiseNotice(500, JText::_('EMAIL_NOT_SENT'));
        }
    }
}
示例#13
0
 /**
  * Send email notifications from the message.
  *
  * @param null|string $url
  *
  * @return bool|null
  */
 public function sendNotification($url = null)
 {
     $config = KunenaFactory::getConfig();
     if (!$config->get('send_emails')) {
         return null;
     }
     if ($this->hold > 1) {
         return null;
     } elseif ($this->hold == 1) {
         $mailsubs = 0;
         $mailmods = $config->mailmod >= 0;
         $mailadmins = $config->mailadmin >= 0;
     } else {
         $mailsubs = (bool) $config->allowsubscriptions;
         $mailmods = $config->mailmod >= 1;
         $mailadmins = $config->mailadmin >= 1;
     }
     $once = false;
     if ($mailsubs) {
         if (!$this->parent) {
             // New topic: Send email only to category subscribers
             $mailsubs = $config->category_subscriptions != 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : 0;
             $once = $config->category_subscriptions == 'topic';
         } elseif ($config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $config->topic_subscriptions != 'disabled' ? KunenaAccess::TOPIC_SUBSCRIPTION : 0;
             $once = $config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $config->topic_subscriptions == 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : KunenaAccess::CATEGORY_SUBSCRIPTION | KunenaAccess::TOPIC_SUBSCRIPTION;
             // FIXME: category subscription can override topic
             $once = $config->topic_subscriptions == 'first';
         }
     }
     if (!$url) {
         $url = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $this->getPermaUrl();
     }
     // Get all subscribers, moderators and admins who should get the email.
     $emailToList = KunenaAccess::getInstance()->getSubscribers($this->catid, $this->thread, $mailsubs, $mailmods, $mailadmins, KunenaUserHelper::getMyself()->userid);
     if ($emailToList) {
         if (!$config->getEmail()) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_DISABLED'));
             return false;
         } elseif (!JMailHelper::isEmailAddress($config->getEmail())) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_INVALID'));
             return false;
         }
         $topic = $this->getTopic();
         // Make a list from all receivers; split the receivers into two distinct groups.
         $sentusers = array();
         $receivers = array(0 => array(), 1 => array());
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             $receivers[$emailTo->subscription][] = $emailTo->email;
             $sentusers[] = $emailTo->id;
         }
         $mailsender = JMailHelper::cleanAddress($config->board_title);
         $mailsubject = JMailHelper::cleanSubject($config->board_title . ' ' . $topic->subject . " (" . $this->getCategory()->name . ")");
         $subject = $this->subject ? $this->subject : $topic->subject;
         // Create email.
         $mail = JFactory::getMailer();
         $mail->setSubject($mailsubject);
         $mail->setSender(array($config->getEmail(), $mailsender));
         // Send email to all subscribers.
         if (!empty($receivers[1])) {
             $this->attachEmailBody($mail, 1, $subject, $url, $once);
             KunenaEmail::send($mail, $receivers[1]);
         }
         // Send email to all moderators.
         if (!empty($receivers[0])) {
             $this->attachEmailBody($mail, 0, $subject, $url, $once);
             KunenaEmail::send($mail, $receivers[0]);
         }
         // Update subscriptions.
         if ($once && $sentusers) {
             $sentusers = implode(',', $sentusers);
             $db = JFactory::getDbo();
             $query = $db->getQuery(true)->update('#__kunena_user_topics')->set('subscribed=2')->where("topic_id={$this->thread}")->where("user_id IN ({$sentusers})")->where('subscribed=1');
             $db->setQuery($query);
             $db->execute();
             KunenaError::checkDatabaseError();
         }
     }
     return true;
 }
示例#14
0
	public function sendNotification($url=null) {
		$config = KunenaFactory::getConfig();
		if ($this->hold > 1) {
			return;
		} elseif ($this->hold == 1) {
			$mailsubs = 0;
			$mailmods = (bool) $config->mailmod;
			$mailadmins = (bool) $config->mailadmin;
		} else {
			$mailsubs = (bool) $config->allowsubscriptions;
			$mailmods = 0;
			$mailadmins = 0;
		}

		$once = false;
		if ($mailsubs) {
			if (!$this->parent) {
				// New topic: Send email only to category subscribers
				$mailsubs = $config->category_subscriptions != 'disabled' ? 3 : 0;
				$once = $config->category_subscriptions == 'topic';
			} elseif ($config->category_subscriptions != 'post') {
				// Existing topic: Send email only to topic subscribers
				$mailsubs = $config->topic_subscriptions != 'disabled' ? 2 : 0;
				$once = $config->topic_subscriptions == 'first';
			} else {
				// Existing topic: Send email to both category and topic subscribers
				$mailsubs = $config->topic_subscriptions == 'disabled' ? 3 : 1;
				// FIXME: category subcription can override topic
				$once = $config->topic_subscriptions == 'first';
			}
		}

		if (!$url) {
			$url = JURI::root().trim($this->getPermaUrl(null, true), '/');
		}
		//get all subscribers, moderators and admins who will get the email
		$me = KunenaUserHelper::get();
		$acl = KunenaFactory::getAccessControl();
		$emailToList = $acl->getSubscribers($this->catid, $this->thread, $mailsubs, $mailmods, $mailadmins, $me->userid);

		$topic = $this->getTopic();
		if (count ( $emailToList )) {
			jimport('joomla.mail.helper');
			if (! $config->email ) {
				KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_DISABLED' ) );
				return false;
			} elseif ( ! JMailHelper::isEmailAddress ( $config->email ) ) {
				KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_INVALID' ) );
				return false;
			}
			// clean up the message for review
			$message = KunenaHtmlParser::plainBBCode ( $this->message );

			$mailsender = JMailHelper::cleanAddress ( $config->board_title );
			$mailsubject = JMailHelper::cleanSubject ( "[" . $config->board_title . "] " . $topic->subject . " (" . $this->getCategory()->name . ")" );
			$subject = $this->subject ? $this->subject : $topic->subject;

			// Make a list from all receivers
			$sentusers = array();
			$receivers = array(0=>array(), 1=>array());
			foreach ( $emailToList as $emailTo ) {
				if (! $emailTo->email || ! JMailHelper::isEmailAddress ( $emailTo->email )) {
					continue;
				}
				$receivers[$emailTo->subscription][] = $emailTo->email;
				$sentusers[] = $emailTo->id;
			}

			// Create email
			$mail = JFactory::getMailer();
			$mail->setSubject($mailsubject);
			$mail->setSender(array($this->_config->email, $mailsender));

			// Send email to all subscribers
			if (!empty($receivers[1])) {
				$mail->setBody($this->createEmailBody(1, $subject, $url, $message, $once));
				$this->sendEmail($mail, $receivers[1]);
			}

			// Send email to all moderators
			if (!empty($receivers[0])) {
				$mail->setBody($this->createEmailBody(0, $subject, $url, $message, $once));
				$this->sendEmail($mail, $receivers[0]);
			}

			// Update subscriptions
			if ($once && $sentusers) {
				$sentusers = implode (',', $sentusers);
				$db = JFactory::getDBO();
				$query = "UPDATE #__kunena_user_topics SET subscribed=2 WHERE topic_id={$this->thread} AND user_id IN ({$sentusers}) AND subscribed=1";
				$db->setQuery ($query);
				$db->query ();
				KunenaError::checkDatabaseError();
			}
		}
	}
示例#15
0
 function doemail()
 {
     jimport('joomla.mail.helper');
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     global $mainframe;
     JClientHelper::setCredentialsFromRequest('ftp');
     $config =& JFactory::getConfig();
     $folder = '';
     $filepaths = array();
     $attached = 0;
     $notattached = 0;
     foreach (JRequest::get('FILES') as $elname => $file) {
         if ($file['name'] != '') {
             if ($folder == '') {
                 $folder = $config->getValue('config.tmp_path') . DS . uniqid('com_fabrik.plg.table.emailtableplus.');
                 if (!JFolder::create($folder)) {
                     JError::raiseWarning(E_NOTICE, JText::_('Could not upload files'));
                     break;
                 }
             }
             $filepath = $folder . DS . JFile::makeSafe($file['name']);
             if (JFile::upload($file['tmp_name'], $filepath)) {
                 $filepaths[count($filepaths)] = $filepath;
                 $attached++;
             } else {
                 JError::raiseWarning(E_NOTICE, JText::sprintf('Could not upload file %s', $file['name']));
             }
         }
     }
     $renderOrder = JRequest::getInt('renderOrder', 0);
     $subject = JMailHelper::cleanSubject(JRequest::getVar('subject'));
     $message = JMailHelper::cleanBody(JRequest::getVar('message'));
     $recordids = explode(',', JRequest::getVar('recordids'));
     $tableModel =& $this->getModel('Table');
     $tableModel->setId(JRequest::getVar('id', 0));
     $formModel =& $tableModel->getForm();
     $this->formModel =& $formModel;
     $params =& $tableModel->getParams();
     $elementModel =& JModel::getInstance('element', 'FabrikModel');
     $field_name = $params->get('emailtableplus_field_name');
     if (is_array($field_name)) {
         $field_name = $field_name[$renderOrder];
     }
     $elementModel->setId($field_name);
     $element =& $elementModel->getElement(true);
     $tonamefield = $elementModel->getFullName(false, true, false);
     $field_email = $params->get('emailtableplus_field_email');
     if (is_array($field_email)) {
         $field_email = $field_email[$renderOrder];
     }
     $elementModel->setId($field_email);
     $element =& $elementModel->getElement(true);
     $tofield = $elementModel->getFullName(false, true, false);
     $fromUser = $params->get('emailtableplus_from_user');
     if (is_array($fromUser)) {
         $fromUser = $fromUser[$renderOrder];
     }
     if ($fromUser[0]) {
         $my =& JFactory::getUser();
         $from = $my->get('email');
         $fromname = $my->get('name');
     } else {
         $config =& JFactory::getConfig();
         $from = $config->getValue('mailfrom');
         $fromname = $config->getValue('fromname');
     }
     $ubcc = $params->get('emailtableplus_use_BCC');
     if (is_array($ubcc)) {
         $ubcc = $ubcc[$renderOrder];
     }
     $useBCC = $ubcc && count($recordids) > 0 && !preg_match('/{[^}]*}/', $subject) && !preg_match('/{[^}]*}/', $message);
     /*
     $include_rowdata = $params->get('emailtableplus_include_rowdata');
     if (is_array($include_rowdata)) {
     	$include_rowdata = $include_rowdata[$renderOrder];
     }
     */
     $sent = 0;
     $notsent = 0;
     if ($useBCC) {
         $bcc = array();
         foreach ($recordids as $id) {
             $row = $tableModel->getRow($id);
             //$message .= $this->_getTextEmail( JArrayHelper::fromObject($row));
             $to = $row->{$tofield};
             $toname = $row->{$tonamefield};
             if (JMailHelper::cleanAddress($to) && JMailHelper::isEmailAddress($to)) {
                 $tofull = '"' . JMailHelper::cleanLine($toname) . '" <' . $to . '>';
                 $bcc[$sent] = $tofull;
                 $sent++;
             } else {
                 $notsent++;
             }
         }
         // $$$ hugh - working round bug in the SMTP mailer method:
         // http://forum.joomla.org/viewtopic.php?f=199&t=530189&p=2190233#p2190233
         // ... which basically means if using the SMTP method, we MUST specify a To addrees,
         // so if mailer is smtp, we'll set the To address to the same as From address
         if ($config->getValue('mailer') == 'smtp') {
             $res = JUtility::sendMail($from, $fromname, $from, $subject, $message, 0, null, $bcc, $filepaths);
         } else {
             $res = JUtility::sendMail($from, $fromname, null, $subject, $message, 0, null, $bcc, $filepaths);
         }
         if (!$res) {
             $notsent += $sent;
             $sent = 0;
         }
     } else {
         $w = new FabrikWorker();
         foreach ($recordids as $id) {
             $row = $tableModel->getRow($id);
             $to = $row->{$tofield};
             $toname = $row->{$tonamefield};
             if (JMailHelper::cleanAddress($to) && JMailHelper::isEmailAddress($to)) {
                 $tofull = '"' . JMailHelper::cleanLine($toname) . '" <' . $to . '>';
                 $thissubject = $w->parseMessageForPlaceholder($subject, $row);
                 $thismessage = $w->parseMessageForPlaceholder($message, $row);
                 $res = JUtility::sendMail($from, $fromname, $tofull, $thissubject, $thismessage, 0, null, null, $filepaths);
                 if ($res) {
                     $sent++;
                 } else {
                     $notsent++;
                 }
             } else {
                 $notsent++;
             }
         }
     }
     if ($folder != '') {
         JFolder::delete($folder);
     }
     if ($attached > 0) {
         $mainframe->enqueueMessage(JText::sprintf('%s files attached', $attached));
     }
     $mainframe->enqueueMessage(JText::sprintf('%s emails sent', $sent));
     if ($notsent != 0) {
         JError::raiseWarning(E_NOTICE, JText::sprintf('%s emails not sent', $notsent));
     }
 }
 function sendReply()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // read the data from the form
     $postData = JRequest::get('post');
     $postData = $this->securityCheck($postData);
     // clear body and subject
     jimport('joomla.mail.helper');
     // make sure the data is valid
     $isOk = true;
     if (!JMailHelper::isEmailAddress($postData['reply_email_address'])) {
         $this->_app->_session->set('isOK:' . $this->_sTask, false);
         $this->_app->_session->set('errorMsg:' . $this->_sTask, JText::_('COM_AICONTACTSAFE_PLEASE_ENTER_A_VALID_EMAIL_ADDRESS'));
     } else {
         if (strlen(trim($postData['reply_subject'])) == 0) {
             $this->_app->_session->set('isOK:' . $this->_sTask, false);
             $this->_app->_session->set('errorMsg:' . $this->_sTask, JText::_('COM_AICONTACTSAFE_PLEASE_SPECIFY_A_SUBJECT'));
         } else {
             if (strlen(trim($postData['reply_message'])) == 0) {
                 $this->_app->_session->set('isOK:' . $this->_sTask, false);
                 $this->_app->_session->set('errorMsg:' . $this->_sTask, JText::_('COM_AICONTACTSAFE_PLEASE_SPECIFY_A_MESSAGE'));
             }
         }
     }
     $isOk = $this->_app->_session->get('isOK:' . $this->_sTask);
     if ($isOk) {
         $from = $this->_app->getCfg('mailfrom');
         $fromname = $this->_app->getCfg('fromname');
         $email_recipient = JMailHelper::cleanAddress($postData['reply_email_address']);
         $subject = JMailHelper::cleanSubject($postData['reply_subject']);
         if (array_key_exists('send_plain_text', $postData) && $postData['send_plain_text']) {
             $mode = false;
             $body = JMailHelper::cleanBody($postData['reply_message']);
         } else {
             $mode = true;
             $body = JMailHelper::cleanBody(str_replace("\n", '<br />', $postData['reply_message']));
         }
         $cc = null;
         $bcc = null;
         $replyto = $from;
         $replytoname = $fromname;
         $file_attachments = null;
         $isOK = JUtility::sendMail($from, $fromname, $email_recipient, $subject, $body, $mode, $cc, $bcc, $file_attachments, $replyto, $replytoname);
     }
     if ($isOk) {
         // initialize the database
         $db = JFactory::getDBO();
         // update the reply
         $query = 'UPDATE #__aicontactsafe_messages SET email_reply = \'' . $this->replace_specialchars($email_recipient) . '\', subject_reply = \'' . $this->replace_specialchars($subject) . '\' , message_reply = \'' . $this->replace_specialchars($body) . '\' WHERE id = ' . (int) $postData['id'];
         $db->setQuery($query);
         $db->query();
         // modify the status of the message accordingly
         $this->changeStatusToReplied((int) $postData['id']);
     }
     return $isOk;
 }
示例#17
0
function sendEmail($configData,$formData)
{
// build the message body from the configured fields

	$body = "From ".$formData['fromName']." at ".$formData['fromAddress']."\r\n";
	if (!empty($formData['list1']))
		$body .= $configData['list_prompt'].": ".$configData['list_array'][$formData['list1']]."\r\n";
	if (!empty($formData['line1']))
		$body .= $configData['line1_prompt'].": ".$formData['line1']."\r\n";
	if (!empty($formData['line2']))
		$body .= $configData['line2_prompt'].": ".$formData['line2']."\r\n";
	if (!empty($formData['line3']))
		$body .= $configData['line3_prompt'].": ".$formData['line3']."\r\n";
	if (!empty($formData['line4']))
		$body .= $configData['line4_prompt'].": ".$formData['line4']."\r\n";
	if (!empty($formData['line5']))
		$body .= $configData['line5_prompt'].": ".$formData['line5']."\r\n";
	if (!empty($formData['area_data']))
		$body .= $configData['area_prompt'].": ".$formData['area_data']."\r\n";

// make sure the body and subject don't contain anything they shouldn't

	jimport('joomla.mail.helper');
	$body = JMailHelper::cleanBody($body);
	$subject = JMailHelper::cleanSubject($formData['subject']);

// get the client information

	$ip = getIPaddress();
	$ipmsg = "Client IP: ".$ip."\r\n";
	$ipmsg .= $_SERVER["HTTP_USER_AGENT"]."\r\n";

// from version 2.11 we now send the mail using the Joomla sendMail function (instead of php mail)
// which uses the mail settings configured in Joomla Global Configuration

	$app = &JFactory::getApplication();
	$from = $app->getCfg('mailfrom');
	$fromname = $app->getCfg('fromname');
	$recipient = $configData['toPrimary'];
	$cc = $configData['cc'];
	$bcc = $configData['bcc'];
	$replyto = $formData['fromAddress'];
	$replytoname = $formData['fromName'];
	
// from version 2.15 we build the mail object ourselves so that we can get at the ErrorInfo

	$mail =& JFactory::getMailer();
	$mail->setSender(array($from, $fromname));
	$mail->setSubject($subject);
	$mail->setBody($body.$ipmsg);
	$mail->addRecipient($recipient);
	if ($cc != '')
		$mail->addCC($cc);
	if ($bcc != '')
		$mail->addBCC($bcc);
	$mail->addReplyTo(array($replyto, $replytoname));
	$ret_main = $mail->Send();
	if ($ret_main === true)
		$status = "Sent OK\r\n";
	else
		$status = "Mail was NOT accepted for delivery (".$mail->ErrorInfo.")\r\n";
	
	logText(JText::_('SUBJECT').": $subject\r\n".
		"To: $recipient\r\n".
		"From: $fromname at $from\r\n".
		"Cc: $cc\r\n".
		"Bcc: $bcc\r\n".
		"ReplyTo: $replytoname at $replyto\r\n".
		$ipmsg.
		$body.
		$status.
		"-------------------------\r\n");
	
// if the user wanted a copy, send that separately

	if ($formData['copyMe'] == 1)
		{
		$mail =& JFactory::getMailer();
		$mail->setSender(array($from, $fromname));
		$mail->setSubject($subject);
		$mail->setBody($body);
		$mail->addRecipient($formData['fromAddress']);
		$ret_copy = $mail->Send();
		if ($ret_copy === true)
			$status = "Sent OK\r\n";
		else
			$status = "Mail was NOT accepted for delivery (".$mail->ErrorInfo.")\r\n";
		logText("Copy to: $recipient\r\n".
			$status.
			"-------------------------\r\n");
		}
	return $ret_main;
}
示例#18
0
 function sendNotifications($item, $subscribers, $params)
 {
     global $globalcats;
     $app = JFactory::getApplication();
     // Get the route helper
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'route.php';
     // Import utility class that contains the send mail helper function
     if (!FLEXI_J16GE) {
         jimport('joomla.utilities.utility');
     }
     jimport('joomla.mail.helper');
     if (FLEXI_J16GE) {
         $mailer = JFactory::getMailer();
         $mailer->Encoding = 'base64';
     }
     // Parameters for 'message' language string
     //
     // 1: $subname	Name of the subscriber
     // 2: $itemid		ID of the item
     // 3: $title		Title of the item
     // 4: $maincat	Main category of the item
     // 5: $link			Link of the item
     // 6: $sitename	Website
     $send_personalized = $params->get('send_personalized', 1);
     if ($send_personalized) {
         // Disable personalized messages if subscriber limit for personal messages is exceeded
         $personalized_limit = $params->get('personalized_limit', 50);
         $personalized_limit = $personalized_limit <= 100 ? $personalized_limit : 100;
         $send_personalized = count($subscribers) <= $personalized_limit ? true : false;
     }
     $include_fullname = $params->get('include_fullname', 1);
     $user_autologin = $params->get('autologin', 1);
     $debug_notifications = $params->get('debug_notifications', 0);
     // *********************************
     // Create variables need for subject
     // *********************************
     $subname = $send_personalized && $include_fullname ? '__SUBSCRIBER_NAME__' : JText::_('FLEXI_SUBSCRIBER');
     $itemid = $item->id;
     $title = $item->title;
     $maincat = $globalcats[$item->catid]->title;
     // Domain URL and autologin vars
     $server = JURI::getInstance()->toString(array('scheme', 'host', 'port'));
     $autologin = $send_personalized && $user_autologin ? '&fcu=__SUBSCRIBER_USERNAME__&fcp=__SUBSCRIBER_PASSWORD__' : '';
     // Check if we are in the backend, in the back end we need to set the application to the site app instead
     $isAdmin = JFactory::getApplication()->isAdmin();
     if ($isAdmin && FLEXI_J16GE) {
         JFactory::$application = JApplication::getInstance('site');
     }
     // Create the URL
     $item_url = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->id . ':' . $item->alias, $globalcats[$item->catid]->slug) . $autologin);
     // Check if we are in the backend again
     // In backend we need to remove administrator from URL as it is added even though we've set the application to the site app
     if ($isAdmin) {
         if (FLEXI_J16GE) {
             $admin_folder = str_replace(JURI::root(true), '', JURI::base(true));
             $item_url = str_replace($admin_folder, '', $item_url);
             // Restore application
             JFactory::$application = JApplication::getInstance('administrator');
         } else {
             $item_url = JURI::root(true) . '/' . $item_url;
         }
     }
     $link = $server . $item_url;
     $link = str_replace('&amp;', '&', $link);
     $sitename = $app->getCfg('sitename') . ' - ' . JURI::root();
     // ************************************************
     // Create parameters passed to mail helper function
     // ************************************************
     $sendermail = $params->get('sendermail', $app->getCfg('mailfrom'));
     $sendermail = JMailHelper::cleanAddress($sendermail);
     $sendername = $params->get('sendername', $app->getCfg('sitename'));
     $subject = $params->get('mailsubject', '') ? JMailHelper::cleanSubject($params->get('mailsubject')) : JText::_('FLEXI_SUBJECT_DEFAULT');
     $message = JText::sprintf('FLEXI_NOTIFICATION_MESSAGE', $subname, $itemid, $title, $maincat, '<a href="' . $link . '">' . $link . '</a>', $sitename);
     $message = nl2br($message);
     // *************************************************
     // Send email notifications about item being updated
     // *************************************************
     // Personalized email per subscribers
     if ($send_personalized) {
         $count_sent = 0;
         $to_arr = array();
         foreach ($subscribers as $subscriber) {
             $to = JMailHelper::cleanAddress($subscriber->email);
             $to_arr[] = $to;
             $_message = $message;
             if ($include_fullname) {
                 $_message = str_replace('__SUBSCRIBER_NAME__', $subscriber->name, $_message);
             }
             if ($user_autologin) {
                 $_message = str_replace('__SUBSCRIBER_USERNAME__', $subscriber->username, $_message);
                 $_message = str_replace('__SUBSCRIBER_PASSWORD__', $subscriber->password, $_message);
             }
             $from = $sendermail;
             $fromname = $sendername;
             $recipient = array($to);
             $html_mode = true;
             $cc = null;
             $bcc = null;
             $attachment = null;
             $replyto = null;
             $replytoname = null;
             $send_result = FLEXI_J16GE ? $mailer->sendMail($from, $fromname, $recipient, $subject, $_message, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname) : JUtility::sendMail($from, $fromname, $recipient, $subject, $_message, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
             if ($send_result) {
                 $count_sent++;
             }
         }
         $send_result = (bool) $count_sent;
         if ($debug_notifications) {
             JFactory::getApplication()->enqueueMessage("** Favourites Notification Plugin: &nbsp; Sent personalized message per subscriber", 'message');
         }
     } else {
         $to_arr = array();
         $count = 0;
         foreach ($subscribers as $subscriber) {
             $to = JMailHelper::cleanAddress($subscriber->email);
             $to_arr[] = $to;
             $to_100_arr[intval($count / 100)][] = $to;
             $count++;
         }
         $count_sent = 0;
         foreach ($to_100_arr as $to_100) {
             $from = $sendermail;
             $fromname = $sendername;
             $recipient = array($from);
             $html_mode = true;
             $cc = null;
             $bcc = $to_100;
             $attachment = null;
             $replyto = null;
             $replytoname = null;
             $send_result = FLEXI_J16GE ? $mailer->sendMail($from, $fromname, $recipient, $subject, $message, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname) : JUtility::sendMail($from, $fromname, $recipient, $subject, $message, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
             if ($send_result) {
                 $count_sent += count($to_100);
             }
         }
         $send_result = (bool) $count_sent;
         if ($debug_notifications) {
             JFactory::getApplication()->enqueueMessage("** Favourites Notification Plugin: &nbsp; Sent same message to all subscribers", 'message');
         }
     }
     // Finally give some feedback to current editor, optionally including emails of receivers if debug is enabled
     $msg = $send_result ? JText::sprintf('FLEXI_NOTIFY_SUCCESS', $count_sent, count($subscribers)) : JText::sprintf('FLEXI_NOTIFY_FAILURE', count($subscribers));
     $msg_receivers = !$debug_notifications ? "" : " <br/> Subscribers List: " . implode(", ", $to_arr);
     $app->enqueueMessage($msg . $msg_receivers, $send_result ? 'message' : 'warning');
 }
 /**
  * Send the message and display a notice
  *
  * @access public
  * @since 1.5
  */
 function send()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $session =& JFactory::getSession();
     $db =& JFactory::getDBO();
     // we return time() instead of 0 (as it previously was), so that the session variable has to be set in order to send the mail
     $timeout = $session->get('com_mailto.formtime', time());
     if ($timeout == 0 || time() - $timeout < MAILTO_TIMEOUT) {
         JError::raiseNotice(500, JText::_('EMAIL_NOT_SENT'));
         return $this->mailto();
     }
     // here we unset the counter right away so that you have to wait again, and you have to visit mailto() first
     $session->set('com_mailto.formtime', null);
     jimport('joomla.mail.helper');
     $SiteName = $mainframe->getCfg('sitename');
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $link = base64_decode(JRequest::getVar('link', '', 'post', 'base64'));
     // Verify that this is a local link
     if (!JURI::isInternal($link)) {
         //Non-local url...
         JError::raiseNotice(500, JText::_('EMAIL_NOT_SENT'));
         return $this->mailto();
     }
     // An array of e-mail headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we find one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos($_POST[$field], $header) !== false) {
                 JError::raiseError(403, '');
             }
         }
     }
     /*
      * Free up memory
      */
     unset($headers, $fields);
     $email = JRequest::getString('mailto', '', 'post');
     $sender = JRequest::getString('sender', '', 'post');
     $from = JRequest::getString('from', '', 'post');
     $subject_default = JText::sprintf('Item sent by', $sender);
     $subject = JRequest::getString('subject', $subject_default, 'post');
     // Check for a valid to address
     $error = false;
     if (!$email || !JMailHelper::isEmailAddress($email)) {
         $error = JText::sprintf('EMAIL_INVALID', $email);
         JError::raiseWarning(0, $error);
     }
     // Check for a valid from address
     if (!$from || !JMailHelper::isEmailAddress($from)) {
         $error = JText::sprintf('EMAIL_INVALID', $from);
         JError::raiseWarning(0, $error);
     }
     if ($error) {
         return $this->mailto();
     }
     // Build the message to send
     $msg = JText::_('EMAIL_MSG');
     $body = sprintf($msg, $SiteName, $sender, $from, $link);
     // Clean the email data
     $subject = JMailHelper::cleanSubject($subject);
     $body = JMailHelper::cleanBody($body);
     $sender = JMailHelper::cleanAddress($sender);
     // Send the email
     if (JUtility::sendMail($from, $sender, $email, $subject, $body) !== true) {
         JError::raiseNotice(500, JText::_('EMAIL_NOT_SENT'));
         return $this->mailto();
     }
     JRequest::setVar('view', 'sent');
     $this->display();
 }
示例#20
0
 function save_comment($cachable = false, $urlparams = array())
 {
     JRequest::checkToken();
     $app = JFactory::getApplication();
     $view = $this->getView('singleimage', 'html');
     /**
      * @var EventgalleryModelSingleimage $model
      */
     $model = $this->getModel('singleimage');
     $view->setModel($model);
     $modelComment = $this->getModel('comment');
     $buzzwords = $model->getBuzzwords();
     $buzzwordsClean = BuzzwordsHelper::validateBuzzwords($buzzwords, JRequest::getVar('text'));
     $data = JRequest::getVar('jform', array(), 'post', 'array');
     $form = $modelComment->getForm();
     $validate = $modelComment->validate($form, $data);
     if ($validate === false || !$buzzwordsClean) {
         // Get the validation messages.
         $errors = $modelComment->getErrors();
         // Push up to three validation messages out to the user.
         for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
             if ($errors[$i] instanceof Exception) {
                 $app->enqueueMessage($errors[$i]->getMessage(), 'warning');
             } else {
                 $app->enqueueMessage($errors[$i], 'warning');
             }
         }
         // Save the data in the session.
         $app->setUserState('com_eventgallery.comment.data', $data);
         // Redirect back to the contact form.
         $msg = JText::_('COM_EVENTGALLERY_SINGLEIMAGE_COMMENT_SAVE_FAILED');
         $this->setRedirect(JRoute::_("index.php?view=singleimage&success=false&folder=" . JRequest::getVar('folder') . "&file=" . JRequest::getVar('file'), false), $msg, 'error');
         return false;
     }
     $validate['file'] = JRequest::getString('file');
     $validate['folder'] = JRequest::getString('folder');
     $row = $model->store_comment($validate, $buzzwordsClean ? 1 : 0);
     // reset the user state
     $app->setUserState('com_eventgallery.comment.data', null);
     $msg = JText::_('COM_EVENTGALLERY_SINGLEIMAGE_COMMENT_SAVE_SUCCESS');
     $this->setRedirect(JRoute::_("index.php?view=singleimage&success=true&folder=" . JRequest::getVar('folder') . "&file=" . JRequest::getVar('file'), false), $msg, 'success');
     $mailer = JFactory::getMailer();
     $params = JComponentHelper::getParams('com_eventgallery');
     $userids = JAccess::getUsersByGroup($params->get('admin_usergroup'));
     if (count($userids) == 0) {
         return;
     }
     foreach ($userids as $userid) {
         $user = JUser::getInstance($userid);
         if ($user->sendEmail == 1) {
             $mailadress = JMailHelper::cleanAddress($user->email);
             $mailer->addRecipient($mailadress);
         }
     }
     $config = JFactory::getConfig();
     $sender = array($config->get('mailfrom'), $config->get('fromname'));
     $mailer->setSender($sender);
     JRequest::setVar('newCommentId', $row->id);
     $mailview = $this->getView('commentmail', 'html');
     /**
      *
      * @var EventgalleryModelComment $commentModel
      */
     $commentModel = $this->getModel('comment');
     $mailview->setModel($commentModel, true);
     $bodytext = $mailview->loadTemplate();
     #$mailer->LE = "\r\n";
     $mailer->LE = "\n";
     $bodytext = JMailHelper::cleanBody($bodytext);
     $mailer->setSubject(JMailHelper::cleanSubject($row->folder . "|" . $row->file . ' - ' . JText::_('COM_EVENTGALLERY_COMMENT_ADD_MAIL_SUBJECT') . ' - ' . $app->getCfg('sitename')));
     $mailer->SetBody($bodytext);
     $mailer->IsHTML(true);
     $mailer->Send();
 }
 /**
  * Sends an email to the organizer
  *
  * @throws  exception
  * @return  object
  */
 public function sendEmail()
 {
     $mainframe = JFactory::getApplication();
     $msg = JText::_("COM_MATUKIO_MAIL_TO_ORGANIZER_SEND_SUCCESSFULL");
     $msg_type = "message";
     jimport('joomla.mail.helper');
     // Check if sending is allowed
     if (!MatukioHelperSettings::getSettings("sendmail_contact", 1)) {
         throw new Exception("COM_MATUKIO_CONTACTING_ORGANIZERS_IS_DISABLED");
     }
     $my = JFactory::getuser();
     $database = JFactory::getDBO();
     $cid = JFactory::getApplication()->input->getInt('event_id', 0);
     $organizer_id = JFactory::getApplication()->input->getInt('organizer_id', 0);
     $uid = JFactory::getApplication()->input->get('art', 0);
     $text = JMailHelper::cleanBody(nl2br(JFactory::getApplication()->input->get('text', '', 'string')));
     $name = JFactory::getApplication()->input->get('name', '', 'string');
     $email = JFactory::getApplication()->input->get('email', '', 'string');
     if ($text != "" && $name != "" && $email != "") {
         $reason = JTEXT::_('COM_MATUKIO_MESSAGE_SEND');
         // Load event (use model function)
         $emodel = JModelLegacy::getInstance('Event', 'MatukioModel');
         $event = $emodel->getItem($cid);
         $subject = "";
         if ($event->semnum != "") {
             $subject .= " " . $event->semnum;
         }
         $subject .= ": " . $event->title;
         $subject = JMailHelper::cleanSubject($subject);
         $sender = $mainframe->getCfg('fromname');
         $from = $mainframe->getCfg('mailfrom');
         if ($my->id == 0) {
             $replyname = $name;
             $replyto = $email;
             // Setting it hardcoded for the body function.. dirk you really give me headaches
             $my->name = $name;
             $my->email = $email;
         } else {
             $replyname = $my->name;
             $replyto = $my->email;
         }
         $body = "\n<head>\n<style type=\"text/css\">\n<!--\nbody {\nfont-family: Verdana, Tahoma, Arial;\nfont-size:12pt;\n}\n-->\n</style></head><body>";
         if ($uid == 1 and $my->id != 0) {
             $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_QUESTION_ABOUT_EVENT') . "</div><p>";
         }
         $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . $text . "</div><p>";
         $temp = array();
         // Mail to Organizer
         if ($uid == 1) {
             $body .= MatukioHelperUtilsEvents::getEmailBody($event, $temp, $my);
             $publisher = JFactory::getUser($event->publisher);
             $email = $publisher->email;
             $mailer = JFactory::getMailer();
             $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname);
         } elseif ($uid == "organizer") {
             $organizer = MatukioHelperOrganizer::getOrganizerId($organizer_id);
             $publisher = JFactory::getuser($organizer->userId);
             $email = $publisher->email;
             $mailer = JFactory::getMailer();
             $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname);
         } else {
             if (!JFactory::getUser()->authorise('core.create', 'com_matukio')) {
                 return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
             }
             $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='" . $event->id . "'");
             $rows = $database->loadObjectList();
             foreach ($rows as $row) {
                 if ($row->userid == 0) {
                     $user = JFactory::getUser(0);
                     $user->email = $row->email;
                     $user->name = $row->name;
                 } else {
                     $user = JFactory::getUser($row->userid);
                 }
                 $text = $body . MatukioHelperUtilsEvents::getEmailBody($event, $row, $user);
                 $mailer = JFactory::getMailer();
                 $mailer->sendMail($from, $sender, $user->email, $subject, $text, 1, null, null, null, $replyto, $replyname);
             }
         }
     } else {
         $msg = JTEXT::_('COM_MATUKIO_MESSAGE_NOT_SEND');
         $msg_type = "error";
     }
     $link = MatukioHelperUtilsBasic::getSitePath() . "index.php?tmpl=component&s=" . MatukioHelperUtilsBasic::getRandomChar() . "&option=" . JFactory::getApplication()->input->get('option') . "&view=contactorganizer&cid=" . $cid . "&art=" . $uid . "&task=19";
     $this->setRedirect($link, $msg, $msg_type);
 }
 function sendEditCoupon(&$item, &$field, $email, $token)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $SiteName = $app->getCfg('sitename');
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $app->getCfg('fromname');
     // Check for a valid from address
     if (!$mailfrom || !JMailHelper::isEmailAddress($mailfrom)) {
         $notice = JText::sprintf('FLEXI_ACCOUNT_V_SUBMIT_INVALID_EMAIL', $mailfrom);
         JError::raiseWarning(0, $notice);
     }
     $subject = JText::sprintf('FLEXI_ACCOUNT_V_SUBMIT_YOUR_NEW_ITEM_AT', $SiteName);
     $desc = JText::_($field->parameters->get('coupon_desc'), '...');
     $link = JRoute::_(JURI::root(false) . FlexicontentHelperRoute::getItemRoute($item->id, $item->catid) . '&task=edit&edittok=' . $token);
     // Build the message to send
     $body = JText::sprintf('FLEXI_ACCOUNT_V_SUBMIT_EDIT_LINK_SEND_INFO', $SiteName, $fromname, $mailfrom, $link);
     $body .= "\n\n" . $desc;
     // Extra text
     // Clean the email data
     $emailSubject = JMailHelper::cleanSubject($subject);
     $emailBody = JMailHelper::cleanBody($body);
     $fromname = JMailHelper::cleanAddress($fromname);
     $recipient = array($email);
     $html_mode = true;
     $cc = null;
     $bcc = null;
     $attachment = null;
     $replyto = null;
     $replytoname = null;
     // Send the email
     $send_result = JFactory::getMailer()->sendMail($mailfrom, $fromname, $recipient, $emailSubject, $emailBody, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
     if ($send_result !== true) {
         JError::raiseWarning(500, JText::_('FLEXI_ACCOUNT_V_SUBMIT_EDIT_LINK_NOT_SENT'));
         return false;
     }
     return true;
 }
示例#23
0
 public function emailToSubscribers($LastPostUrl = false, $mailsubs = false, $mailmods = false, $mailadmins = false)
 {
     if ($LastPostUrl === false) {
         jimport('joomla.environment.uri');
         $uri = JURI::getInstance(JURI::base());
         $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetMessageURL($this->get('id'), $this->get('catid'), 0, false);
     }
     $once = false;
     if ($mailsubs) {
         if (!$this->get('parent')) {
             // New topic: Send email only to category subscribers
             $mailsubs = $this->_config->category_subscriptions != 'disabled' ? 3 : 0;
             $once = $this->_config->category_subscriptions == 'topic';
         } elseif ($this->_config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $this->_config->topic_subscriptions != 'disabled' ? 2 : 0;
             $once = $this->_config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $this->_config->topic_subscriptions == 'disabled' ? 3 : 1;
             // FIXME: category subcription can override topic
             $once = $this->_config->topic_subscriptions == 'first';
         }
     }
     // Fetch all subscribers, moderators and admins who will get the email
     $emailToList = CKunenaTools::getEMailToList($this->get('catid'), $this->get('thread'), $mailsubs, $mailmods, $mailadmins, $this->_my->id);
     if (count($emailToList)) {
         jimport('joomla.mail.helper');
         kimport('html.parser');
         if (!$this->_config->email) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_DISABLED'));
             return false;
         } else {
             if (!JMailHelper::isEmailAddress($this->_config->email)) {
                 KunenaError::warning(JText::_('COM_KUNENA_EMAIL_INVALID'));
                 return false;
             }
         }
         // clean up the message for review
         $authorname = $this->get('name');
         $message = KunenaParser::stripBBCode($this->get('message'), 0, false);
         $subject = $this->get('subject');
         $topicsubject = $this->parent->subject ? $this->parent->subject : $subject;
         $mailsender = JMailHelper::cleanAddress($this->_config->board_title);
         $mailsubject = JMailHelper::cleanSubject("[" . $this->_config->board_title . "] " . $topicsubject . " (" . $this->parent->catname . ")");
         // Make a list from all receivers
         $sentusers = array();
         $receivers = array(0 => array(), 1 => array());
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             $receivers[$emailTo->subscription][] = $emailTo->email;
             $sentusers[] = $emailTo->id;
         }
         // Create email
         $mail = JFactory::getMailer();
         $mail->setSubject($mailsubject);
         $mail->setSender(array($this->_config->email, $mailsender));
         // Send email to all subscribers
         $mail->setBody($this->createEmailBody(1, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[1]);
         // Send email to all moderators
         $mail->setBody($this->createEmailBody(0, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[0]);
         // Update subscriptions
         if ($once && $sentusers) {
             $sentusers = implode(',', $sentusers);
             $db = JFactory::getDBO();
             $query = "UPDATE #__kunena_subscriptions\n\t\t\t\t\tSET future1=1 WHERE thread={$this->get('thread')} AND userid IN ({$sentusers})";
             $db->setQuery($query);
             $db->query();
             KunenaError::checkDatabaseError();
         }
     }
 }
示例#24
0
 public static function sendnotification($referrerid, $assignpoints, $newtotal, $result, $force = 0)
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     if (!$referrerid || $referrerid == 'GUEST') {
         return;
     }
     $db = JFactory::getDBO();
     jimport('joomla.mail.helper');
     // get params definitions
     $params = JComponentHelper::getParams('com_alphauserpoints');
     $jsNotification = $params->get('jsNotification', 0);
     $jsNotificationAdmin = $params->get('fromIdUddeim', 0);
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $sef = $app->getCfg('sef');
     $userinfo = AlphaUserPointsHelper::getUserInfo($referrerid);
     $email = $userinfo->email;
     $rule_name = $result->rule_name;
     $subject = $result->emailsubject;
     $body = $result->emailbody;
     $formatMail = $result->emailformat;
     $bcc2admin = $result->bcc2admin;
     if (!$userinfo->block || $force) {
         if ($subject != '' && $body != '') {
             $subject = str_replace('{username}', $userinfo->username, $subject);
             $subject = str_replace('{points}', AlphaUserPointsHelper::getFPoints(abs($assignpoints)), $subject);
             $subject = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $subject);
             $body = str_replace('{username}', $userinfo->username, $body);
             $body = str_replace('{points}', AlphaUserPointsHelper::getFPoints(abs($assignpoints)), $body);
             $body = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $body);
             $body = str_replace('{datareference}', $result->datareference, $body);
         } else {
             // default message
             if ($assignpoints > 0) {
                 $subject = JText::_('AUP_EMAILNOTIFICATION_SUBJECT');
                 $body = sprintf(JText::_('AUP_EMAILNOTIFICATION_MSG'), $SiteName, AlphaUserPointsHelper::getFPoints($assignpoints), AlphaUserPointsHelper::getFPoints($newtotal), JText::_($rule_name));
             } elseif ($assignpoints < 0) {
                 $subject = JText::_('AUP_EMAILNOTIFICATION_SUBJECT_ACCOUNT_UPDATED');
                 $body = sprintf(JText::_('AUP_EMAILNOTIFICATION_MSG_REMOVE_POINTS'), $SiteName, AlphaUserPointsHelper::getFPoints(abs($assignpoints)), AlphaUserPointsHelper::getFPoints($newtotal), JText::_($rule_name));
             }
         }
         $subject = JMailHelper::cleanSubject($subject);
         //$body    = JMailHelper::cleanBody($body);
         if (!$jsNotification) {
             $mailer = JFactory::getMailer();
             $mailer->setSender(array($MailFrom, $FromName));
             $mailer->setSubject($subject);
             $mailer->isHTML((bool) $formatMail);
             $mailer->CharSet = "utf-8";
             $mailer->setBody($body);
             $mailer->addRecipient($email);
             if ($bcc2admin) {
                 // get all users allowed to receive e-mail system
                 $query = "SELECT email" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
                 $db->setQuery($query);
                 $rowsAdmins = $db->loadObjectList();
                 foreach ($rowsAdmins as $rowsAdmin) {
                     $mailer->addBCC($rowsAdmin->email);
                 }
             }
             $send = $mailer->Send();
         } else {
             require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
             //$actor = CFactory::getUser();
             $params = new CParameter('');
             CNotificationLibrary::add('system_messaging', $jsNotificationAdmin, $userinfo->id, $subject, $body, '', $params);
             if ($bcc2admin) {
                 // get all users allowed to receive e-mail system
                 $query = "SELECT id" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
                 $db->setQuery($query);
                 $rowsAdmins = $db->loadObjectList();
                 foreach ($rowsAdmins as $rowsAdmin) {
                     $mailer->addBCC($rowsAdmin->id);
                     CNotificationLibrary::add('system_messaging', $userinfo->id, $rowsAdmin->id, $subject, $body, '', $params);
                 }
             }
         }
     }
 }
示例#25
0
 public function sendContactForm()
 {
     jimport('joomla.mail.helper');
     $app = JFactory::getApplication();
     // Get a JMail instance
     $mailer = JFactory::getMailer();
     $params = $app->getParams();
     $defaultFrom = $mailer->From;
     $defaultFromname = $mailer->FromName;
     $data = array('name' => JMailHelper::cleanLine($this->getState('contact.name')), 'email' => JMailHelper::cleanAddress($this->getState('contact.email')), 'telephone' => JMailHelper::cleanLine($this->getState('contact.telephone')), 'subject' => JMailHelper::cleanSubject($this->getState('contact.subject')) . ' [' . $defaultFromname . ']', 'message' => JMailHelper::cleanText($this->getState('contact.message')), 'propertyURL' => $this->getState('contact.propertyURL'));
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('jea');
     if ($params->get('use_captcha')) {
         $plugin = JFactory::getConfig()->get('captcha');
         if ($plugin == '0') {
             $plugin = 'recaptcha';
         }
         $captcha = JCaptcha::getInstance($plugin);
         // Test the value.
         if (!$captcha->checkAnswer('')) {
             $error = $captcha->getError();
             if ($error instanceof Exception) {
                 $this->setError($error->getMessage());
             } else {
                 $this->setError($error);
             }
         }
     }
     // Check data
     if (empty($data['name'])) {
         $this->setError(JText::_('COM_JEA_YOU_MUST_TO_ENTER_YOUR_NAME'));
     }
     if (empty($data['message'])) {
         $this->setError(JText::_('COM_JEA_YOU_MUST_TO_ENTER_A_MESSAGE'));
     }
     if (!JMailHelper::isEmailAddress($data['email'])) {
         $this->setError(JText::sprintf('COM_JEA_INVALID_EMAIL_ADDRESS', $data['email']));
     }
     if ($this->getErrors()) {
         return false;
     }
     $result = $dispatcher->trigger('onBeforeSendContactForm', array($data));
     if (in_array(false, $result, true)) {
         return false;
     }
     $recipients = array();
     $defaultMail = $params->get('default_mail');
     $agentMail = '';
     if ($params->get('send_form_to_agent') == 1) {
         $item = $this->getItem();
         $db = $this->getDbo();
         $q = 'SELECT `email` FROM `#__users` WHERE `id`=' . (int) $item->created_by;
         $db->setQuery($q);
         $agentMail = $db->loadResult();
     }
     if (!empty($defaultMail) && !empty($agentMail)) {
         $recipients[] = $defaultMail;
         $recipients[] = $agentMail;
     } elseif (!empty($defaultMail)) {
         $recipients[] = $defaultMail;
     } elseif (!empty($agentMail)) {
         $recipients[] = $agentMail;
     } else {
         // Send to the webmaster email
         $recipients[] = $defaultFrom;
     }
     $body = $data['message'] . "\n";
     if (!empty($data['telephone'])) {
         $body .= "\n" . JText::_('COM_JEA_TELEPHONE') . ' : ' . $data['telephone'];
     }
     $body .= "\n" . JText::_('COM_JEA_PROPERTY_URL') . ' : ' . $data['propertyURL'];
     $mailer->setBody($body);
     $ret = $mailer->sendMail($data['email'], $data['name'], $recipients, $data['subject'], $body, false);
     if ($ret == true) {
         $app->setUserState('contact.name', '');
         $app->setUserState('contact.email', '');
         $app->setUserState('contact.telephone', '');
         $app->setUserState('contact.subject', '');
         $app->setUserState('contact.message', '');
         return true;
     }
     return false;
 }
示例#26
0
文件: helper.php 项目: adjaika/J3Base
 /**
  * Helper wrapper method for cleanSubject
  *
  * @param   string  $subject  email subject string.
  *
  * @return  string  Cleaned email subject string.
  *
  * @see     JMailHelper::cleanSubject()
  * @since   3.4
  */
 public function cleanSubject($subject)
 {
     return JMailHelper::cleanSubject($subject);
 }
 /**
  * Sends E-Mails to participants, organizers etc.
  *
  * $art:
  * 1: booking confirmation
  * 2: cancel confirmation (user)
  * 3: cancel confirmation (admin)
  * 4: deleted
  * 5: published
  * 6: certificated
  * 7: certificate revoked
  * 8: max number reached
  * 9: republished event
  * 10: canceld
  * 11: updated
  * 12: confirmation
  * 13: confirmation to organizer with CSV file
  * 14: info to organizer
  * 15: invoice email
  *
  * @param   object  $event         - The event object
  * @param   int     $uid           - The user id?
  * @param   int     $art           - The Task
  * @param   bool    $cancel        - Should we cancel
  * @param   object  $booking       - The booking
  * @param   bool    $send_invoice  - Should the invoice send?
  *
  * @todo update, rewrite and optimize
  * @throws  Exception
  * @return  void
  */
 public static function sendBookingConfirmationMail($event, $uid, $art, $cancel = false, $booking = null, $send_invoice = true)
 {
     jimport('joomla.mail.helper');
     jimport('joomla.mail.mail');
     $mainframe = JFactory::getApplication();
     if (MatukioHelperSettings::getSettings('sendmail_teilnehmer', 1) > 0 or MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0) {
         $database = JFactory::getDbo();
         // Load event (use events helper function)
         if ($booking == null) {
             if (!$cancel) {
                 $database->setQuery("SELECT * FROM #__matukio_bookings WHERE id = " . $uid);
             } else {
                 $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid = " . $event->id . " AND userid = " . $uid);
             }
             $booking = $database->loadObject();
         }
         if ($booking->userid == 0) {
             $user = JFactory::getUser(0);
             $user->name = $booking->name;
             $user->email = $booking->email;
         } else {
             $user = JFactory::getuser($booking->userid);
         }
         $publisher = JFactory::getuser($event->publisher);
         $body1 = "<p><span style=\"font-size:10pt;\">" . JTEXT::_('COM_MATUKIO_PLEASE_DONT_ANSWER_THIS_EMAIL') . "</span><p>";
         $body2 = $body1;
         $gebucht = self::calculateBookedPlaces($event);
         $gebucht = $gebucht->booked;
         // We just add a first line and then switch to default booking confirmation
         if ($art == 11) {
             $body1 = JTEXT::_('COM_MATUKIO_ORGANISER_UPDATED_YOUR_BOOKING');
             $art = 1;
         }
         switch ($art) {
             // Booking confirmation
             case 1:
             case 2:
             case 3:
                 break;
             case 4:
                 $body1 .= JTEXT::_('COM_MATUKIO_ADMIN_DELETED_THE_FOLLOWING_EVENT');
                 $body2 .= JTEXT::_('COM_MATUKIO_ADMIN_DELETED_EVENT');
                 break;
             case 5:
                 $body1 .= JTEXT::_('COM_MATUKIO_ADMIN_PUBLISHED_EVENT_YOUR_BOOKING_IS_VALID');
                 $body2 .= JTEXT::_('COM_MATUKIO_ADMIN_PUBLISHED_EVENT_THE_BOOKING_OF_PARTICIPANTS_IS_VALID');
                 break;
             case 6:
                 $body1 .= JTEXT::_('COM_MATUKIO_THE_ADMIN_CERTIFIED_YOU');
                 $body2 .= JTEXT::_('COM_MATUKIO_ADMIN_HAS_CERTIFICATED_FOLLOWING_PARTICIPANT');
                 if (MatukioHelperSettings::getSettings('frontend_userprintcertificate', 0) > 0) {
                     $body1 .= " " . JTEXT::_('COM_MATUKIO_YOU_CAN_PRINT_YOUR_CERTIFICATE');
                 }
                 break;
             case 7:
                 $body1 .= JTEXT::_('COM_MATUKIO_CERTIFICAT_REVOKED');
                 $body2 .= JTEXT::_('COM_MATUKIO_ADMIN_HAS_WITHDRAWN_CERTIFICATE_FOR_FOLLOWNG_PARITICIPANTS');
                 break;
             case 8:
                 if ($gebucht > $event->maxpupil) {
                     if ($event->stopbooking = 0) {
                         $body1 .= JTEXT::_('COM_MATUKIO_MAX_PARTICIPANT_NUMBER_REACHED');
                     } else {
                         $body1 .= JTEXT::_('COM_MATUKIO_ORGANISER_REGISTERED_YOU') . " " . JTEXT::_('COM_MATUKIO_YOU_ARE_BOOKED_ON_THE_WAITING_LIST');
                     }
                 } else {
                     $body1 .= JTEXT::_('COM_MATUKIO_ORGANISER_REGISTERED_YOU');
                 }
                 $body2 .= JTEXT::_('COM_MATUKIO_YOU_HAVE_REGISTRED_PARTICIPANT_FOR');
                 break;
             case 9:
                 $body1 .= JTEXT::_('COM_MATUKIO_ORGANISER_HAS_REPUBLISHED_EVENT');
                 $body2 .= JTEXT::_('COM_MATUKIO_THE_BOOKING_OF_THE_PARTICIPANT_IS_VALID_AGAIN');
                 break;
             case 10:
                 $body1 .= JTEXT::_('COM_MATUKIO_ORGANISER_CANCELLED');
                 $body2 .= JTEXT::_('COM_MATUKIO_BOOKING_NO_LONGER_VALID');
                 break;
             case 11:
                 $body1 .= JTEXT::_('COM_MATUKIO_ORGANISER_UPDATED_YOUR_BOOKING');
                 $body2 .= JTEXT::_('');
                 break;
             case 12:
                 $body1 .= JTEXT::_('COM_MATUKIO_EVENT_IS_TAKING_PLACE');
                 break;
             case 13:
                 $body1 .= JTEXT::_('COM_MATUKIO_ORGANIZER_EVENT_IS_TAKING_PLACE');
                 break;
             case 14:
                 $body1 .= JTEXT::_('COM_MATUKIO_ORGANIZER_EVENT_HAS_TAKEN_PLACE');
                 break;
             case 15:
                 // Invoice
                 break;
         }
         $abody = "\n<head>\n<style type=\"text/css\">\n<!--\nbody {\nfont-family: Verdana, Tahoma, Arial;\nfont-size:12pt;\n}\n-->\n</style></head><body>";
         $sender = $mainframe->getCfg('fromname');
         $from = $mainframe->getCfg('mailfrom');
         $htxt = "";
         if ($event->semnum != "") {
             $htxt = " " . $event->semnum;
         }
         $subject = JTEXT::_('COM_MATUKIO_EVENT') . $htxt . ": " . $event->title;
         $subject = JMailHelper::cleanSubject($subject);
         $replyname = $publisher->name;
         $replyto = $publisher->email;
         $email = $user->email;
         if ($art == 1 || $art == 2 || $art == 3 || $art == 15) {
             // New booking templates @since  2.2.0
             if (($art == 2 || $art == 3) && MatukioHelperSettings::_("booking_stornoconfirmation") == 0) {
                 // The user should get no storno confirmationen email
                 return;
             }
             $start = $body1;
             if (!empty($body1)) {
                 $start .= " \n";
             }
             if ($booking->status == MatukioHelperUtilsBooking::$WAITLIST && $art == 1) {
                 $start .= JTEXT::_('COM_MATUKIO_YOU_ARE_BOOKED_ON_THE_WAITING_LIST');
             } elseif ($booking->status == MatukioHelperUtilsBooking::$ACTIVE && $art == 1) {
                 $start .= JTEXT::_('COM_MATUKIO_YOUR_BOOKING_IS_ACTIVE_AND_RESERVED');
             } elseif ($booking->status == MatukioHelperUtilsBooking::$PENDING && $art == 1) {
                 $start .= JTEXT::_('COM_MATUKIO_YOUR_BOOKING_IS_PENDING_AND_NOT_RESERVED');
             }
             $tmpl_name = MatukioHelperTemplates::getEmailTemplateName($art);
             $tmpl = MatukioHelperTemplates::getEmailBody($tmpl_name, $event, $booking);
             // Use HTML or text E-Mail
             if (MatukioHelperSettings::getSettings('email_html', 1)) {
                 // Start html output
                 $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
                 $body .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
                 $body .= "<head>\n";
                 $body .= "</head>\n";
                 $body .= "<body>\n";
                 $body .= $start . "<br />" . $tmpl->value;
                 $body .= "</body>\n</html>";
             } else {
                 $body = $start . "\n" . $tmpl->value_text;
             }
             $subject = $tmpl->subject;
             $mailer = JFactory::getMailer();
             if ($art == 1 && MatukioHelperSettings::getSettings('sendmail_ticket', 1) && $booking->status == MatukioHelperUtilsBooking::$ACTIVE) {
                 $t_sub = JText::_("COM_MATUKIO_TICKET");
                 $ticket_pdf = MatukioHelperPDF::getTicket($booking, $event, $t_sub, "S");
                 $fn = "ticket-" . MatukioHelperUtilsBooking::getBookingId($booking->id) . ".pdf";
                 $mailer->AddStringAttachment($ticket_pdf, $fn, 'base64', 'application/pdf');
             }
             // Check if we really want to send this E-Mail
             if (MatukioHelperSettings::getSettings('sendmail_teilnehmer', 1) > 0 and $art < 11) {
                 $success = $mailer->sendMail($from, $sender, $email, $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname);
             }
             if (MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0 and $art < 11) {
                 $mailer->ClearAllRecipients();
                 $success = $mailer->sendMail($from, $sender, $publisher->email, $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname);
             }
             // E-Mail to Admin / Operator etc.
             if (MatukioHelperSettings::getSettings('sendmail_operator', '') != "" and $art < 11) {
                 $mailer->ClearAllRecipients();
                 $success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname);
             }
             // We need to clear attachements here (Ticket etc.)
             $mailer->ClearAttachments();
             $mailer->ClearAllRecipients();
             if (($art == 1 || $art == 15) && MatukioHelperSettings::getSettings('sendmail_invoice', 1) && $booking->status == MatukioHelperUtilsBooking::$ACTIVE && $event->fees > 0 && $send_invoice) {
                 $invoice = MatukioHelperTemplates::getEmailBody("invoice_email", $event, $booking);
                 $inv_body = $invoice->value;
                 $inv_subject = $invoice->subject;
                 $inv_pdf = MatukioHelperPDF::getInvoice($booking, $event, $inv_subject, "S");
                 $fn = "invoice-" . MatukioHelperUtilsBooking::getBookingId($booking->id) . ".pdf";
                 $mailer->AddStringAttachment($inv_pdf, $fn, 'base64', 'application/pdf');
                 if (MatukioHelperSettings::getSettings('sendmail_teilnehmer', 1) > 0) {
                     $success = $mailer->sendMail($from, $sender, $email, $inv_subject, $inv_body, 1, null, null, null, $replyto, $replyname);
                     $mailer->ClearAllRecipients();
                 }
                 // E-Mail Organizer
                 if (MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0) {
                     $success = $mailer->sendMail($from, $sender, $publisher->email, $inv_subject, $inv_body, 1, null, null, null, $replyto, $replyname);
                     $mailer->ClearAllRecipients();
                 }
                 // E-Mail to Admin / Operator etc.
                 if (MatukioHelperSettings::getSettings('sendmail_operator', '') != '') {
                     $success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $inv_subject, $inv_body, 1, null, null, null, $replyto, $replyname);
                     $mailer->ClearAllRecipients();
                 }
             }
         } elseif ($art == 13 || $art == 14) {
             // E-Mails only to organizers (not to bookings!)
             $body = $abody . $body1 . self::getEmailBody($event, $booking, $user);
             $mailer = JFactory::getMailer();
             if ($art == 13) {
                 // ADD CSV list
                 $fn = "bookings-" . $event->title . ".csv";
                 $csvcontent = MatukioHelperUtilsEvents::generateCSVFile(false, $event->id, null, $event);
                 $mailer->AddStringAttachment($csvcontent, $fn, 'base64', 'application/octet-stream');
             }
             if (MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0) {
                 $success = $mailer->sendMail($from, $sender, $publisher->email, $subject, $body, 1, null, null, null, $replyto, $replyname);
                 $mailer->ClearAllRecipients();
             }
             // E-Mail to Admin / Operator etc.
             if (MatukioHelperSettings::getSettings('sendmail_operator', '') != "") {
                 $success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname);
                 $mailer->ClearAllRecipients();
             }
         } else {
             // Old ones
             $body = $abody . $body1 . self::getEmailBody($event, $booking, $user);
             $mailer = JFactory::getMailer();
             if (MatukioHelperSettings::getSettings('sendmail_teilnehmer', 1) > 0) {
                 $success = $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname);
                 $mailer->ClearAllRecipients();
             }
             if (MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0) {
                 $success = $mailer->sendMail($from, $sender, $publisher->email, $subject, $body, 1, null, null, null, $replyto, $replyname);
                 $mailer->ClearAllRecipients();
             }
             // E-Mail to Admin / Operator etc.
             if (MatukioHelperSettings::getSettings('sendmail_operator', '') != "") {
                 $success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname);
                 $mailer->ClearAllRecipients();
             }
         }
     }
 }
示例#28
0
 /**
  * Substitute keywords in email subject
  *
  * @return string Email subject
  */
 protected function subject()
 {
     // Read the subject from the form configuration
     $subject = JMailHelper::cleanSubject($this->Params->get("email_subject"));
     // Call the replacement engine for each variable found
     $expanded = preg_replace_callback('/{(.*?)}/', array("FDispatcher", "expand_variables"), $subject);
     return $expanded;
 }
示例#29
0
 /**
  * Send the message and display a notice
  *
  * @access public
  * @since 1.5
  */
 function send()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $db = JFactory::getDbo();
     $timeout = $session->get('com_mailto.formtime', 0);
     if ($timeout == 0 || time() - $timeout < 20) {
         JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT'));
         return $this->mailto();
     }
     jimport('joomla.mail.helper');
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $link = MailtoHelper::validateHash(JRequest::getCMD('link', '', 'post'));
     // Verify that this is a local link
     if (!$link || !JURI::isInternal($link)) {
         //Non-local url...
         JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT'));
         return $this->mailto();
     }
     // An array of email headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we find one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos($_POST[$field], $header) !== false) {
                 JError::raiseError(403, '');
             }
         }
     }
     /*
      * Free up memory
      */
     unset($headers, $fields);
     $email = JRequest::getString('mailto', '', 'post');
     $sender = JRequest::getString('sender', '', 'post');
     $from = JRequest::getString('from', '', 'post');
     $subject_default = JText::sprintf('COM_MAILTO_SENT_BY', $sender);
     $subject = JRequest::getString('subject', $subject_default, 'post');
     // Check for a valid to address
     $error = false;
     if (!$email || !JMailHelper::isEmailAddress($email)) {
         $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $email);
         JError::raiseWarning(0, $error);
     }
     // Check for a valid from address
     if (!$from || !JMailHelper::isEmailAddress($from)) {
         $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $from);
         JError::raiseWarning(0, $error);
     }
     if ($error) {
         return $this->mailto();
     }
     // Build the message to send
     $msg = JText::_('COM_MAILTO_EMAIL_MSG');
     $body = sprintf($msg, $SiteName, $sender, $from, $link);
     // Clean the email data
     $subject = JMailHelper::cleanSubject($subject);
     $body = JMailHelper::cleanBody($body);
     $sender = JMailHelper::cleanAddress($sender);
     // Send the email
     if (JUtility::sendMail($from, $sender, $email, $subject, $body) !== true) {
         JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT'));
         return $this->mailto();
     }
     JRequest::setVar('view', 'sent');
     $this->display();
 }
 /**
  * Rates an event
  *
  * @throws  Exception if user is not logged in
  * @return  void / redirect
  */
 public function rate()
 {
     // Check if user is logged in
     if (JFactory::getUser()->id == 0) {
         throw new Exception("COM_MATUKIO_NO_ACCESS");
     }
     $msg = JText::_("COM_MATUKIO_RATING_SUCCESSFULL");
     $mainframe = JFactory::getApplication();
     jimport('joomla.mail.helper');
     $my = JFactory::getuser();
     $database = JFactory::getDBO();
     $cid = JFactory::getApplication()->input->getInt('cid', 0);
     $grade = JFactory::getApplication()->input->getInt('grade', 0);
     $text = JFactory::getApplication()->input->get('text', '');
     $text = str_replace(array("\"", "\\'"), "", $text);
     $text = JMailHelper::cleanBody($text);
     $database->setQuery("UPDATE #__matukio_bookings SET grade='" . $grade . "', comment='" . $text . "' WHERE semid='" . $cid . "' AND userid='" . $my->id . "'");
     if (!$database->execute()) {
         JError::raiseError(500, $database->getError());
         exit;
     }
     $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='" . $cid . "'");
     $rows = $database->loadObjectList();
     $zaehler = 0;
     $wertung = 0;
     foreach ($rows as $row) {
         if ($row->grade > 0) {
             $wertung = $wertung + $row->grade;
             $zaehler++;
         }
     }
     if ($zaehler > 0) {
         $geswert = round($wertung / $zaehler);
     } else {
         $geswert = 0;
     }
     $database->setQuery("UPDATE #__matukio SET grade='{$geswert}' WHERE id='{$cid}'");
     if (!$database->execute()) {
         JError::raiseError(500, $database->getError());
         $msg = "COM_MATUKIO_RATING_FAILED " . $database->getError();
     }
     if (MatukioHelperSettings::getSettings('sendmail_owner', 1) > 0) {
         $database->setQuery("SELECT * FROM #__matukio_bookings WHERE semid='{$cid}' AND userid='{$my->id}'");
         $buchung = $database->loadObject();
         // Load event (use model function)
         $emodel = JModelLegacy::getInstance('Event', 'MatukioModel');
         $row = $emodel->getItem($cid);
         $publisher = JFactory::getuser($row->publisher);
         $body = "\n<head>\n<style type=\"text/css\">\n<!--\nbody {\nfont-family: Verdana, Tahoma, Arial;\nfont-size:12pt;\n}\n-->\n</style></head><body>";
         $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_RECEIVED_RATING') . "</div>";
         $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_RATING') . ":</div>";
         $htxt = str_replace('SEM_POINTS', $grade, JTEXT::_('COM_MATUKIO_SEM_POINTS_6'));
         $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . $htxt . "</div>";
         $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_COMMENT') . ":</div>";
         $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . htmlspecialchars($text) . "</div>";
         $body .= "<p><div style=\"font-size: 10pt\">" . JTEXT::_('COM_MATUKIO_AVARAGE_SCORE') . ":</div>";
         $htxt = str_replace('SEM_POINTS', $geswert, JTEXT::_('COM_MATUKIO_SEM_POINTS_6'));
         $body .= "<div style=\"border: 1px solid #A0A0A0; width: 100%; padding: 5px;\">" . $htxt . "</div>";
         $body .= "<p>" . MatukioHelperUtilsEvents::getEmailBody($row, $buchung, $my);
         $sender = $mainframe->getCfg('fromname');
         $from = $mainframe->getCfg('mailfrom');
         $replyname = $my->name;
         $replyto = $my->email;
         $email = $publisher->email;
         $subject = JTEXT::_('COM_MATUKIO_EVENT');
         if ($row->semnum != "") {
             $subject .= " " . $row->semnum;
         }
         $subject .= ": " . $row->title;
         $subject = JMailHelper::cleanSubject($subject);
         $mailer = JFactory::getMailer();
         $mailer->sendMail($from, $sender, $email, $subject, $body, 1, null, null, null, $replyto, $replyname);
     }
     $link = "index.php?option=com_matukio&tmpl=component&s=" . MatukioHelperUtilsBasic::getRandomChar() . "&view=rateevent&cid=" . $cid;
     $this->setRedirect($link, $msg);
 }