Current File : /home/pacjaorg/public_html/km/administrator/components/com_djclassifieds/controllers/email.php
<?php
/**
 * @package DJ-Classifieds
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email: contact@dj-extensions.com
 */

defined('_JEXEC') or die;

class DJClassifiedsControllerEmail extends JControllerForm
{
	public function save($key = null, $urlVar = null) {
		return parent::save($key, $urlVar);
	}

	public function savesend()
	{
		$app = JFactory::getApplication();
		$user = JFactory::getUser();
		$db = JFactory::getDBO();

		$mailfrom = $app->getCfg('mailfrom');
		$fromname = DJClassifiedsNotify::getFromname();
		$mailto = DJClassifiedsNotify::getAdminMailto();
		$id = $app->input->getInt('id');

		parent::save();

		$query = "SELECT e.* FROM #__djcf_emails e WHERE e.id = ".$id." LIMIT 1";
		$db->setQuery($query);
		$email = $db->loadObject();

		// $title = $app->input->getArray()['jform']['title'];
		// $content = nl2br($app->input->getArray()['jform']['content']);

		$title = DJClassifiedsNotify::parseMessageSubject($email->title, $id, null, $user);
		$content = DJClassifiedsNotify::parseMessageBody($email->content, $id, null, $user);

		$mailer = JFactory::getMailer();    		
		$mailer->setSender(array($mailfrom, $fromname));
		$mailer->setSubject($title);
		$mailer->setBody($content);
		$mailer->IsHTML(true);
		$mailer->addRecipient($mailto);

		if(!is_object($mailer->Send())){
			$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_MESSAGE_SENT'), 'success');
		}else{
			$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_MESSAGE_NOT_SENT'), 'error');
		}
		$app->redirect('index.php?option=com_djclassifieds&view=email&layout=edit&id='.$id);
	}
	
}

?>
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!