0

I have following email controller in my custom module not sending emails. when I print the $params arrays it giving the output not email is not sending. Please check and let me know what is wrong with this

public function sendemailAction()
{       $params = $this->getRequest()->getParams(); 
        print_r($params);

        $body = '<h3>Contact Form</h3><p>Hello,</p>
        <p>We have received this message from the website:</p>
        <p><b>Name:</b> ' . ($params['name']) . '<br>
        <p><b>Email:</b> ' . ($params['email']) . '<br>
        <b>Comments:</b> ' . ($params['comment']) . '</p>';         
        $mail = new Zend_Mail();        
        $mail->setBodyHtml($body);        
        $mail->setFrom($params['email'], $params['name']);        
        $mail->addTo('test@test.com');        
        $mail->setSubject('Contact Form');        

        try {            

            $mail->send(); 

        }        

            catch(Exception $ex) 

        {           
        Mage::getSingleton('core/session')->addError('Unable to send email. Sample of a custom notification error from Contact Us Form.');         

        }           $this->_redirect('reviews/');

    }  
  • check this answer magento.stackexchange.com/questions/85373/… – Qaisar Satti Nov 30 '16 at 11:23
  • Invalid method Mage_Core_Model_Email::addTo(Array ( [0] => tests@techleadz.com ) @QaisarSatti – Xabby Nov 30 '16 at 11:43
  • Changed addTo with setToEmail still the error unable to send – Xabby Nov 30 '16 at 11:44
  • did you check other email is working eg: forgot password, create account etc – Qaisar Satti Nov 30 '16 at 11:45
  • Actually its not sending as i am on local server like(Xamp) may be that cause the issue? @QaisarSatti – Xabby Nov 30 '16 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.