Jump to content

jim007

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by jim007

  1. When I select contact everything works like it is supposed to, fields, captcha, and successfully sent... but no mail shows up. Is there something in the code that I have wrong? Please liberate my brain! I fried it trying to figure this out. I know it is something simple that I am over looking also. thank you in advance! and I do apologize for my lack of knowledge of this but I am trying (old dog - not good with new tricks)

    <?php
    /**
     * ------------------------------------------------------------------------
     * for Joomla 3.x
     * ------------------------------------------------------------------------
     *
     * @----------------------------------------------------------------------@
     */
    
    // No direct access to this file
    defined('_JEXEC') or die('Restricted access');
    
    jimport('joomla.application.component.controllerform');
    
    class JUDirectoryControllerContact extends JControllerForm
    {
    	
    	protected $text_prefix = 'COM_JUDIRECTORY_CONTACT';
    
    	
    	public function send()
    	{
    		
    		JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
    		$app                = JFactory::getApplication();
    		$data               = $app->input->post->get('jform', array(), 'array');
    		$listingId          = $data['listing_id'];
            $sendCopy           = isset($data['sendcopy']) ? true : false;
    
    		if ($listingId)
    		{
    			
    			$showCaptcha = JUDirectoryFrontHelperPermission::showCaptchaWhenContactListing($listingId);
    			if ($showCaptcha)
    			{
    				$permission = JUDirectoryFrontHelperCaptcha::checkCaptcha();
    				if (!$permission)
    				{
    					$this->setRedirect(JRoute::_(JUDirectoryHelperRoute::getContactRoute($listingId), false));
    					$this->setMessage(JText::_('COM_JUDIRECTORY_INVALID_CAPTCHA'), 'error');
    
    					return false;
    				}
    			}
    
    			
    			if (!JUDirectoryFrontHelperMail::sendEmailByEvent('listing.contact', $listingId, $data))
    			{
    				$this->setRedirect(JRoute::_(JUDirectoryHelperRoute::getContactRoute($listingId), false));
    				$this->setMessage(JText::_('COM_JUDIRECTORY_FAIL_TO_SEND_CONTACT_EMAIL'), 'error');
    
    				return false;
    			}
    
    			if ($sendCopy)
    			{
    				if (JUDirectoryFrontHelperMail::sendEmailByEvent('listing.contactcopy', $listingId, $data))
    				{
    					$this->setMessage(JText::_('COM_JUDIRECTORY_SEND_CONTACT_COPY_EMAIL_SUCCESSFULLY'));
    				}
    				else
    				{
    					$this->setMessage(JText::_('COM_JUDIRECTORY_FAIL_TO_SEND_CONTACT_COPY_EMAIL'), 'error');
    				}
    			}
    
    			$this->setRedirect(JRoute::_(JUDirectoryHelperRoute::getContactRoute($listingId), false));
    			$this->setMessage(JText::_('COM_JUDIRECTORY_SEND_CONTACT_EMAIL_SUCCESSFULLY'));
    
    			return true;
    		}
    
    		$this->setRedirect(JRoute::_(JUDirectoryHelperRoute::getContactRoute($listingId), false));
    		$this->setMessage(JText::_('COM_JUDIRECTORY_FAIL_TO_SEND_CONTACT_EMAIL'), 'error');
    
    		return false;
    	}
    
    	public function cancel($key = null)
    	{
    		
    		JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
    		$app       = JFactory::getApplication();
    		$listingId = $app->input->getInt('listing_id', 0);
            $listingObject = JUDirectoryHelper::getListingById($listingId);
    		$this->setRedirect(JRoute::_(JUDirectoryHelperRoute::getListingRoute($listingId, '', $listingObject->language), false));
    	}
    }
    
    
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.