Jump to content

Confused by no mail showing up


jim007

Recommended Posts

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));
	}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.