Sign in to follow this  
Followers 0
odessa888

Agent Form is not working

2 posts in this topic

Problem is solved

Need to change file  /components/com_bt_property/controllers/agent.php

Search for 

function sendmsg() {

And change all code to

function sendmsg() {

        JRequest::checkToken() or jexit('Invalid Token');

        $app = JFactory::getApplication();
        $agent = JUser::getTable();
        $agent->load($app->input->getInt('agent_id'));
        $name = $app->input->getString('name');
        $email = $app->input->getString('email');
			    $phone = $app->input->getString('phone');
        $content = $app->input->getString('content');
			    $referrer = $_SERVER['HTTP_REFERER'] ? 'This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';
        if($agent->email){
            $config    = JFactory::getConfig();
            $emailSubject    = 'Agent Enquiry - Complete Home Realty';
            $emailBody = "$agent->name $name $email $phone $content $referrer";


            $send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody);


        }
        if($send){
            $msg= JTEXT::_('COM_BT_PROPERTY_SEND_MESSAGE_AGENT_SUCCESS');

        }else{
            $msg= JTEXT::_('COM_BT_PROPERTY_SEND_MESSAGE_AGENT_FAIL');
        }
        $return_url = base64_decode(JRequest::getVar('return',''));
        if($return_url){
            $this->setRedirect($return_url, $msg);
        }else{
            $this->setRedirect(JRoute::_('index.php'), $msg);
        }
    }
}

Now form works!

If you need to add aditional mail

Search for:

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody);

And change it to:

$send = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $agent->email, $emailSubject, $emailBody, false, 'your_client_email_here');

Best Regardz

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0