public function save() { // Check for request forgeries JSession::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN'); $cid = JRequest::getInt("cid", 0); $post = JRequest::get('post'); if ($cid > 0) { $club = JTable::getInstance("Club", "Table"); $club->load($cid); $club->bind($post); $params = JComponentHelper::getParams('com_joomleague'); if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") { $user = JFactory::getUser(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('u.email'); $query->from('#__users AS u'); $query->leftJoin('#__user_usergroup_map AS map ON map.user_id = u.id'); $query->leftJoin('#__usergroups AS g ON g.id = map.group_id'); $query->where('g.title = ' . $db->quote("Super Users") . ' OR g.title = ' . $db->quote("Administrator")); $query->order('u.username ASC'); $db->setQuery($query); $to = $db->loadColumn(); $subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name)); $message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name)); $message .= $this->_getShowClubInfoLink(); JMail::sendMail('', '', $to, $subject, $message); } } $this->setRedirect($this->_getShowClubInfoLink()); }
public function save() { // Check for request forgeries JSession::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN'); $cid = JRequest::getInt("cid", 0); $post = JRequest::get('post'); if ($cid > 0) { $club =& JTable::getInstance("Club", "Table"); $club->load($cid); $club->bind($post); $params = JComponentHelper::getParams('com_joomleague'); if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") { $db = JFactory::getDbo(); $user = JFactory::getUser(); $query = "SELECT email\n FROM #__users \n WHERE usertype = 'Super Administrator' \n OR usertype = 'Administrator'"; $db->setQuery($query); $to = $db->loadColumn(); $subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name)); $message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name)); $message .= $this->_getShowClubInfoLink(); JMail::sendMail('', '', $to, $subject, $message); } } $this->setRedirect($this->_getShowClubInfoLink()); }
function sendHotelEmail($data) { //dmp($data); $body = $data["email_note"]; $mode = 1; //html //dmp($body); $ret = JMail::sendMail($data["email_from_address"], $data["email_from_name"], $data["email_to_address"], "Share hotel", $body, $mode); if ($data["copy_yourself"] == 1) { $ret = JMail::sendMail($data["email_from_address"], $data["email_from_name"], $data["email_from_address"], "Share hotel", $body, $mode); } return $ret; }
/** * Sends a username reminder to the e-mail address * specified containing the specified username. * @param string A user's e-mail address * @param string A user's username * @return bool True on success/false on failure */ function _sendReminderMail($email, $username) { $config = JFactory::getConfig(); $uri = JFactory::getURI(); $url = $uri->__toString(array('scheme', 'host', 'port')) . JRoute::_('index.php?option=com_user&view=login', false); $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $subject = JText::sprintf('COM_CITRUSCART_CITRUSCART_USER_EMAIL_REMINDER', $config->getValue('sitename')); $body = JText::sprintf('COM_CITRUSCART_USERNAME_REMINDER_EMAIL_TEXT', $config->getValue('sitename'), $username, $url); if (!JMail::sendMail($from, $fromname, $email, $subject, $body)) { $this->setError('COM_CITRUSCART_ERROR_SENDING_REMINDER_EMAIL'); return false; } return true; }
function sendMailTo($listOfRecipients, $subject, $message) { $app = JFactory::getApplication(); $mailFrom = $app->getCfg('mailfrom'); $fromName = $app->getCfg('fromname'); JMail::sendMail($mailFrom, $fromName, $listOfRecipients, $subject, $message); }
public static function juserRegister($juser) { $result = array(); $oseMscconfig = oseRegistry::call('msc')->getConfig('', 'obj'); $config = JFactory::getConfig(); $params = JComponentHelper::getParams('com_users'); $newUserType = self::getNewUserType($params->get('new_usertype')); $juser['gid'] = $newUserType; $data = (array) self::getJuserData($juser); // Initialise the table with JUser. $user = new JUser; foreach ($juser as $k => $v) { $data[$k] = $v; } // Prepare the data for the user object. $useractivation = $params->get('useractivation'); // Check if the user needs to activate their account. if (($useractivation == 1) || ($useractivation == 2)) { jimport('joomla.user.helper'); $data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword()); $data['block'] = 1; } // Bind the data. if (!$user->bind($data)) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()); } // Load the users plugin group. JPluginHelper::importPlugin('user'); if (!$user->save()) { $result['success'] = false; $result['title'] = 'Error'; $result['reload'] = ($oseMscconfig->error_registration == 'refresh') ? true : false; ; $result['content'] = JText::_($user->getError()); } else { // Mark the user_id in order to user in payment form if (($useractivation == 1) || ($useractivation == 2)) { $session = JFactory::getSession(); $oseUser = array(); $oseUser['user_id'] = $user->id; $oseUser['block'] = true; $oseUser['activation'] = true; $session->set('ose_user', $oseUser); } $result['success'] = true; $result['user'] = $user; $result['title'] = 'Done'; $result['content'] = 'Juser saved successfully'; // Compile the notification mail values. $data = $user->getProperties(); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['siteurl'] = JUri::base(); if (JOOMLA16 == true) { // Handle account activation/confirmation emails. if ($useractivation == 2) { // Set the link to confirm the user email. $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false); $emailSubject = JText::sprintf('COM_USERS_OSEMSC_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']); $emailBody = JText::sprintf('COM_USERS_OSEMSC_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']); } else if ($useractivation == 1) { // Set the link to activate the user account. $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false); $emailSubject = JText::sprintf('COM_USERS_OSEMSC_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']); $emailBody = JText::sprintf('COM_USERS_OSEMSC_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']); } else { $emailSubject = ""; $emailBody = ""; } // Send the registration email. if (!empty($emailSubject) && !empty($emailBody)) { if (JOOMLA30 == true) { $mailer = new JMail(); $return = $mailer->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody); } else { $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody); } } else { $return = true; } // Check for an error. if ($return !== true) { $this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED')); // Send a system message to administrators receiving system mails $db = JFactory::getDBO(); $q = "SELECT id FROM #__users WHERE block = 0 AND sendEmail = 1"; $db->setQuery($q); $sendEmail = $db->loadResultArray(); if (count($sendEmail) > 0) { $jdate = new JDate(); // Build the query to add the messages $q = "INSERT INTO `#__messages` (`user_id_from`, `user_id_to`, `date_time`, `subject`, `message`) VALUES "; $messages = array(); foreach ($sendEmail as $userid) { $messages[] = "(" . $userid . ", " . $userid . ", '" . $jdate->toMySQL() . "', '" . JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT') . "', '" . JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username']) . "')"; } $q .= implode(',', $messages); $db->setQuery($q); $db->query(); } //return false; } if ($useractivation == 1) { $result['user_active'] = "useractivate"; } else if ($useractivation == 2) { $result['user_active'] = "adminactivate"; } else { $result['user_active'] = null; } } else { $mainframe = JFactory::getApplication('SITE'); if ($useractivation == 1) { $password = $data['password_clear']; $db = JFactory::getDBO(); $name = $user->get('name'); $email = $user->get('email'); $username = $user->get('username'); $usersConfig = &JComponentHelper::getParams('com_users'); $sitename = $mainframe->getCfg('sitename'); $useractivation = $usersConfig->get('useractivation'); $mailfrom = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $siteURL = JURI::base(); $subject = sprintf(JText::_('ACCOUNT_DETAILS_FOR'), $name, $sitename); $subject = html_entity_decode($subject, ENT_QUOTES); $message = sprintf(JText::_('SEND_MSG_ACTIVATE'), $name, $sitename, $siteURL . "index.php?option=com_user&task=activate&activation=" . $user->get('activation'), $siteURL, $username, $password); $message = html_entity_decode($message, ENT_QUOTES); //get all super administrator $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"'; $db->setQuery($query); $rows = $db->loadObjectList(); // Send email to user if (!$mailfrom || !$fromname) { $fromname = $rows[0]->name; $mailfrom = $rows[0]->email; } JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message); // Send notification to all administrators $subject2 = sprintf(JText::_('ACCOUNT_DETAILS_FOR'), $name, $sitename); $subject2 = html_entity_decode($subject2, ENT_QUOTES); // get superadministrators id foreach ($rows as $row) { if ($row->sendEmail) { $message2 = sprintf(JText::_('SEND_MSG_ADMIN'), $row->name, $sitename, $name, $email, $username); $message2 = html_entity_decode($message2, ENT_QUOTES); JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2); } } } else { $name = $user->get('name'); $email = $user->get('email'); $username = $user->get('username'); $usersConfig = &JComponentHelper::getParams('com_users'); $sitename = $mainframe->getCfg('sitename'); $useractivation = $usersConfig->get('useractivation'); $mailfrom = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $siteURL = JURI::base(); $message = sprintf(JText::_('SEND_MSG'), $name, $sitename, $siteURL); } } } return $result; }
function _sendMail(&$user, $password) { $input = JFactory::getApplication()->input; global $mainframe; $db = JFactory::getDBO(); $name = $user->get('name'); $email = $user->get('email'); $username = $user->get('username'); $usersConfig = JComponentHelper::getParams('com_users'); $sitename = $mainframe->getCfg('sitename'); $useractivation = $usersConfig->get('useractivation'); $mailfrom = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $siteURL = JURI::base(); $subject = sprintf(JText::_('COM_CITRUSCART_ACCOUNT_DETAILS_FOR'), $name, $sitename); $subject = html_entity_decode($subject, ENT_QUOTES); if ($useractivation == 1) { $message = sprintf(JText::_('COM_CITRUSCART_SEND_MSG_ACTIVATE'), $name, $sitename, $siteURL . "index.php?option=com_user&task=activate&activation=" . $user->get('activation'), $siteURL, $username, $password); } else { $message = sprintf(JText::_('COM_CITRUSCART_SEND_MSG'), $name, $sitename, $siteURL); } $message = html_entity_decode($message, ENT_QUOTES); //get all super administrator $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"'; $db->setQuery($query); $rows = $db->loadObjectList(); // Send email to user if (!$mailfrom || !$fromname) { $fromname = $rows[0]->name; $mailfrom = $rows[0]->email; } JMail::sendMail($mailfrom, $fromname, $email, $subject, $message); // Send notification to all administrators $subject2 = sprintf(JText::_('COM_CITRUSCART_ACCOUNT_DETAILS_FOR'), $name, $sitename); $subject2 = html_entity_decode($subject2, ENT_QUOTES); // get superadministrators id foreach ($rows as $row) { if ($row->sendEmail) { $message2 = sprintf(JText::_('COM_CITRUSCART_SEND_MSG_ADMIN'), $row->name, $sitename, $name, $email, $username); $message2 = html_entity_decode($message2, ENT_QUOTES); JMail::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2); } } }
function addJoomlaUser($reservationDetails) { // "generate" a new JUser Object $user = JFactory::getUser(0); // it's important to set the "0" otherwise your admin user information will be loaded jimport('joomla.application.component.helper'); $usersParams =& JComponentHelper::getParams('com_users'); // load the Params $userdata = array(); // place user data in an array for storing. $userdata['name'] = $reservationDetails->reservationData->userData->last_name . ' ' . $reservationDetails->reservationData->userData->first_name; $userdata['email'] = $reservationDetails->reservationData->userData->email; $userdata['username'] = $reservationDetails->reservationData->userData->email; //set password $userdata['password'] = UserService::generatePassword($reservationDetails->reservationData->userData->email, true); $userdata['password2'] = $userdata['password']; //set default group. $usertype = $usersParams->get('new_usertype', 2); if (!$usertype) { $usertype = 'Registered'; } //default to defaultUserGroup i.e.,Registered $userdata['groups'] = array($usertype); $useractivation = $usersParams->get('useractivation'); // in this example, we load the config-setting if ($useractivation == 1) { $config = JFactory::getConfig(); $userdata['sitename'] = $config->get('sitename'); $userdata['siteurl'] = JUri::base(); $userdata['sitename'] = $config->get('sitename'); $userdata['siteurl'] = JUri::base(); jimport('joomla.user.helper'); // include libraries/user/helper.php $userdata['block'] = 1; // block the User $userdata['activation'] = JApplication::getHash(JUserHelper::genRandomPassword()); // set activation hash (don't forget to send an activation email) $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $userdata['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $userdata['activation'], false); $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $userdata['name'], $userdata['sitename']); $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $userdata['name'], $userdata['sitename'], $userdata['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $userdata['activation'], $userdata['siteurl'], $userdata['username'], $userdata['password']); $appSettings = JHotelUtil::getInstance()->getApplicationSettings(); $fromName = $appSettings->company_name; $confirmEmail = $appSettings->company_email; $mail = new JMail(); $response = $mail->sendMail($confirmEmail, $fromName, $userdata['email'], $emailSubject, $emailBody); if ($response !== true) { JError::raiseWarning('', JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED', true)); } } else { // no we need no activation $userdata['block'] = 0; // don't block the user } //now to add the new user to the dtabase. if (!$user->bind($userdata)) { $this->log->LogDebug("Exception when binding user - confirmtion" . JText::_($user->getError())); JError::raiseWarning('', JText::_($user->getError())); // something went wrong!! } if (!$user->save()) { // now check if the new user is saved $this->log->LogDebug("Exception when adding user_id to confirmtion" . JText::_($user->getError())); JError::raiseWarning('', JText::_($user->getError())); // something went wrong!! } return $user->id; }
function sendReviewEmail() { $template = "Review Email"; $templ = $this->getEmailTemplate($template); if ($templ == null) { return false; } $templEmail = $this->prepareEmail($templ->email_content); //return false; $config =& JFactory::getConfig(); //$this->itemAppSettings->sendmail_from = $config->get( 'config.mailfrom' ); //$this->itemAppSettings->sendmail_name = $config->get( 'config.fromname' ); $fromName = $this->itemAppSettings->company_name; //$mainframe->getCfg('fromname'); $confirmEmail = $this->itemAppSettings->company_email; //$mainframe->getCfg('fromname'); $hotelName = $this->itemHotelSelected->hotel_name; $templ->email_subject = str_replace(EMAIL_HOTEL_NAME, $hotelName, $templ->email_subject); $body = $templEmail; $mode = 1; //html $ret = true; $ret = JMail::sendMail($this->itemAppSettings->company_email, $this->itemAppSettings->company_name, $this->email, $templ->email_subject, $body, $mode); JHotelReservationModelVariables::writeMessage(" Sending review email to " . $this->email . " result" . $ret); return $ret; }
function sendKissUserMail($uid = 0, $fileName, $method = 1, $data, $info = array()) { // Load the parameters. $app = JFactory::getApplication(); $paramsC = JComponentHelper::getParams(KISS_COMPONENT_JDIR); $db = JFactory::getDBO(); $sitename = $app->getCfg('sitename'); $fromname = $sitename; $date = JHTML::_('date', gmdate('Y-m-d H:i:s'), JText::_('DATE_FORMAT_LC2')); $user = JFactory::getUser(); $link0 = JURI::root() . "index.php?option=" . KISS_COMPONENT_JDIR; $today = date("Y-m-d H:i:s"); $timestamp = time(); $mailer = new JMail(); if ($paramsC->notify_email_from) { $email = $paramsC->notify_email_from; } else { $mailfrom = $app->getCfg('mailfrom'); } if (isset($user->username) && $user->username != '') { $senderName = ' (' . self::getUserName($user->get('id')) . ')'; } else { $senderName = ''; } // Retrieve some user data $uprofile = self::getUserProfile($data->uid); $name = isset($uprofile['firstname']) ? $uprofile['firstname'] . " " . $uprofile['name'] : $uprofile['name']; $userName = isset($uprofile['username']) ? $uprofile['username'] : JText::_('KISS_GENERAL_ANONYMOUS'); $email = isset($uprofile['email']) ? $uprofile['email'] : ''; if (strlen($email) < 1 && strlen($data->it_contact_email) > 0) { $email = $field['it_contact_email']->encrypted ? self::decrypted($data->it_contact_email) : $data->it_contact_email; } $uname = $name; if (isset($uprofile['address'])) { $uname .= ", " . $uprofile['postcode'] . " " . $uprofile['city']; } if (isset($data)) { $adid = $data->id; $adident = $data->it_ident; $dtitle = $data->title; $intro = $data->it_intro; $createdate = date($paramsC->get('dateformat'), $data->date_created); $usernumber = $data->uid; $plan = self::getUserPlan($usernumber); $prune = $plan->expiry > 0 ? $plan->expiry : $plan->duration; $expirydate = date($paramsC->get('dateformat'), strtotime($data->date_created . " + " . $prune . " days")); } switch ($method) { case 1: // Message submitted $link = $link0 . "&view=item&id=" . $adid; $subject = $info['subject']; $mailfrom = $info['from']; $title = JText::_('KISS_MAIL_MESSAGE_SUBMISSION'); $messageText = sprintf(JText::_('KISS_MAIL_MESSAGE_SUBMISSION_TEXT_USER'), $name, $sitename, $adident, $dtitle, $intro, $info['message'], $link); break; case 2: // Comment submitted $subject = $sitename . ' - ' . JText::_('KISS_MAIL_COMMENT_SUBMISSION'); $title = JText::_('KISS_MAIL_COMMENT_SUBMISSION'); $messageText = sprintf(JText::_('KISS_MAIL_COMMENT_SUBMITTED_TEXT_USER'), $name, $sitename, $adident, $dtitle, $intro, $info['commenttitle'], $info['commenttext']); break; case 3: // Entry deleted during pruning $subject = $sitename . ' - ' . JText::_('KISS_MAIL_ENTRY_DELETED'); $title = JText::_('KISS_MAIL_ENTRY_DELETED'); $messageText = sprintf(JText::_('KISS_MAIL_ENTRY_DELETED_TEXT_USER'), $name, $sitename, $dtitle, $intro, $uname, $createdate); break; case 4: // Entry prolongation during pruning $link = $link0 . "&task=prolongation&id=" . $adid; $subject = $sitename . ' - ' . JText::_('KISS_MAIL_ENTRY_PROLONGATION'); $title = JText::_('KISS_MAIL_ENTRY_PROLONGATION'); $messageText = sprintf(JText::_('KISS_MAIL_ENTRY_PROLONGATION_TEXT_USER'), $name, $sitename, $plan->prolong, $adident, $dtitle, $intro, $link); break; case 5: // New entry submitted $link = $link0 . "&view=item&id=" . $adid; $subject = $sitename . ' - ' . JText::_('KISS_MAIL_NEWENTRY_USER_SUBJECT'); $title = JText::_('KISS_MAIL_NEWENTRY_USER_SUBJECT'); $messageText = sprintf(JText::_('KISS_MAIL_NEWENTRY_USER_BODY'), $name, $sitename, $adident, $dtitle, $intro, $uname, $expirydate, $link); break; case 6: // Entry expiration message $link = $link0 . "&view=account"; $subject = $sitename . ' - ' . JText::_('KISS_MAIL_EXPENTRY_USER_SUBJECT'); $title = JText::_('KISS_MAIL_EXPENTRY_USER_SUBJECT'); $messageText = sprintf(JText::_('KISS_MAIL_EXPENTRY_USER_BODY'), $name, $sitename, $adident, $dtitle, $intro, $uname, $expirydate, $link); break; case 7: // New entry in category (rss notification) $link = $link0 . "&view=account"; $subject = $sitename . ' - ' . JText::_('KISS_MAIL_EXPENTRY_USER_SUBJECT'); $title = sprintf(JText::_('KISS_MAIL_NEWENTRY_CATEGORY_SUBJECT'), $sitename); $messageText = sprintf(JText::_('KISS_MAIL_NEWENTRY_CATEGORY_BODY'), $name, $sitename, $adident, $dtitle, $intro, $createdate, $expirydate, $link); } $message = $title . "\n\n" . JText::_('KISS_GENERAL_FIELD_WEBSITE_LABEL') . ': ' . $sitename . "\n" . JText::_('KISS_GENERAL_DATE') . ': ' . $date . "\n" . JText::_('KISS_MAIL_MESSAGE') . ': ' . "\n" . "\n\n" . $messageText . "\n\n" . JText::_('KISS_MAIL_REGARDS') . ", \n" . $senderName . "\n" . $sitename . "\n"; $subject = html_entity_decode($subject, ENT_QUOTES); $message = html_entity_decode($messageText, ENT_QUOTES); //get all registered users $query = 'SELECT id, name, email, sendEmail' . ' FROM ' . KISS_COMPONENT_JPFX . 'users WHERE id = ' . $uid; $db->setQuery($query); $row = $db->loadObject(); $tomail = isset($email) && strlen($email) ? $email : $row->email; if (JMailHelper::isEmailAddress($tomail)) { // Notify via email if ($paramsC->get('notify_direct_admin', 0) == 0) { $mailer->sendMail($mailfrom, $fromname, $tomail, $subject, $message); } else { // Notify via messaging system $messagingText = $message; $messageText = sprintf(JText::_('KISS_MAIL_MESSAGING_NOTIFICATION'), $name, $sitename); $mailer->sendMail($mailfrom, $fromname, $tomail, $subject, $messageText); // Is uddeim installed ? if (self::table_exists('uddeim') && self::field_exists('uddeim', 'message') && $this->pre->l4) { $query = "INSERT INTO " . KISS_COMPONENT_JPFX . "uddeim (`disablereply`, `fromid`, `toid`, `datum`, `totrash`, `message`)\n\t\t\t\t\t\t\t\tVALUES ( 1, " . $user->get('id') . ", " . $user->get('id') . ", '{$timestamp}', 0, '{$messagingText}')\n\t\t\t\t\t\t\t\t"; } else { $query = "INSERT INTO " . $db->quoteName(KISS_COMPONENT_JPFX . "messages") . " (`state`, `user_id_from`, `user_id_to`, `date_time`, `subject`, `message`)\n\t\t\t\t\t\t\t\tVALUES ( 0, " . $user->get('id') . ", " . $user->get('id') . ", '{$today}', '{$subject}', '{$messagingText}')\n\t\t\t\t\t\t\t\t"; } $db->setQuery($query); $db->query(); } } return true; }
function shSendEmailToAdmin($logData) { if (!sh404SEF_SEC_MAIL_ATTACKS_TO_ADMIN) { return; } $mainframe = JFactory::getApplication(); $subject = str_replace('%sh404SEF_404_SITE_NAME%', $mainframe->getCfg('sitename'), sh404SEF_SEC_EMAIL_TO_ADMIN_SUBJECT); $logText = ''; foreach ($logData as $key => $text) { $logText .= "\n" . $key . "\t\t" . ' :: ' . shSecOutput(JString::trim($text)); } $body = str_replace('%sh404SEF_404_SITE_URL%', Sh404sefFactory::getPageInfo()->getDefaultFrontLiveSite(), sh404SEF_SEC_EMAIL_TO_ADMIN_BODY); $body = str_replace('%sh404SEF_404_ATTACK_DETAILS%', $logText, $body); if (!defined('_ISO')) { define('_ISO', 'charset=iso-8859-1'); } jimport('joomla.mail.mail'); JMail::sendMail($mainframe->getCfg('mailfrom'), $mainframe->getCfg('fromname'), $mainframe->getCfg('mailfrom'), $subject, $body); }
/** * Sends a password reset request confirmation to the * specified e-mail address with the specified token. * * @since 1.5 * @param string An e-mail address * @param string An md5 hashed randomly generated string * @return bool True on success/false on failure */ function _sendConfirmationMail($email, $token) { $config = JFactory::getConfig(); $uri = JFactory::getURI(); $url = JURI::base() . 'index.php?option=com_citruscart&view=reset&layout=confirm'; $sitename = $config->getValue('sitename'); // Set the e-mail parameters $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $subject = JText::sprintf('COM_CITRUSCART_CITRUSCART_PASSWORD_RESET', $sitename); $body = JText::sprintf('COM_CITRUSCART_PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $token, $url); // Send the e-mail if (!JMail::sendMail($from, $fromname, $email, $subject, $body)) { $this->setError('COM_CITRUSCART_ERROR_SENDING_CONFIRMATION_EMAIL'); return false; } return true; }
/** * Send email to super administrator and user * * @param object $row The message object * @param object $ticket The ticket object * @param object $config */ public static function sendNewTicketNotificationEmails($row, $config) { $app = JFactory::getApplication(); if ($app->isAdmin()) { $Itemid = HelpdeskProHelper::getItemid(); } else { $Itemid = JRequest::getInt('Itemid'); } $jconfig = new JConfig(); $db = JFactory::getDbo(); $siteUrl = JURI::root(); if ($config->from_email) { $fromEmail = $config->from_email; } else { $fromEmail = $jconfig->mailfrom; } if ($config->from_name) { $fromName = $config->from_name; } else { $fromName = $jconfig->fromname; } $sql = 'SELECT title FROM #__helpdeskpro_categories WHERE id=' . $row->category_id; $db->setQuery($sql); $categoryTitle = $db->loadResult(); $replaces = array(); $replaces['ticket_id'] = $row->id; $replaces['ticket_subject'] = $row->subject; $replaces['name'] = $row->name; $replaces['ticket_message'] = $row->message; $replaces['frontend_link'] = $siteUrl . 'index.php?option=com_helpdeskpro&view=ticket&cid[]=' . $row->id . '&Itemid=' . $Itemid; $replaces['backend_link'] = $siteUrl . 'administrator/index.php?option=com_helpdeskpro&view=ticket&cid[]=' . $row->id . '&Itemid=' . $Itemid; $replaces['frontend_link_without_login'] = $siteUrl . 'index.php?option=com_helpdeskpro&view=ticket&ticket_code=' . $row->ticket_code . '&Itemid=' . $Itemid; $replaces['category_title'] = $categoryTitle; $sql = 'SELECT managers FROM #__helpdeskpro_categories WHERE id=' . $row->category_id; $db->setQuery($sql); $managers = $db->loadResult(); $managers = trim($managers); if ($managers) { $managers = explode(',', $managers); for ($i = 0, $n = count($managers); $i < $n; $i++) { $managers[$i] = trim($managers[$i]); } $sql = 'SELECT email FROM #__users WHERE username IN ("' . implode('","', $managers) . '")'; $db->setQuery($sql); $emails = $db->loadResultArray(); } else { //Send email to general notification emails $emails = explode(',', $config->notification_emails); for ($i = 0, $n = count($emails); $i < $n; $i++) { $emails[$i] = trim($emails[$i]); } } //Send message to administrators/managers $subject = $config->new_ticket_admin_email_subject; $body = $config->new_ticket_admin_email_body; foreach ($replaces as $key => $value) { $key = strtoupper($key); $body = str_replace("[{$key}]", $value, $body); $subject = str_replace("[{$key}]", $value, $subject); } if (version_compare(JVERSION, '3.0', 'ge')) { $j3 = true; $mailer = new JMail(); } else { $j3 = false; } foreach ($emails as $email) { if ($email) { if ($j3) { $mailer->sendMail($fromEmail, $fromName, $email, $subject, $body, 1); } else { JUtility::sendMail($fromEmail, $fromName, $email, $subject, $body, 1); } } } //Send email to user $subject = $config->new_ticket_user_email_subject; $body = $config->new_ticket_user_email_body; foreach ($replaces as $key => $value) { $key = strtoupper($key); $body = str_replace("[{$key}]", $value, $body); $subject = str_replace("[{$key}]", $value, $subject); } if ($j3) { $mailer->sendMail($fromEmail, $fromName, $row->email, $subject, $body, 1); } else { JUtility::sendMail($fromEmail, $fromName, $row->email, $subject, $body, 1); } }