I am very new to MAGENTO, I have build a brand new extension. So i have created form now i want to send all details in html to admin as well as guest user.I am using below code for it.

$mail = new Zend_Mail();
$mail->addTo('test@gmail.com', 'Some Recipient');
$mail->setSubject('Test su');
$mail = Mage::getModel('core/email'); 

Thanks for help.

  • 1
    Can you be more clear. Are you getting an error? Is it not sending? Is email in general working? – Sander Mangel Sep 10 '15 at 11:38
  • i am getting row html – Vikash Rao Sep 10 '15 at 11:40

Few days ago i have created a extension for it i am posting code here, hope it will help you.

class Arunendra_Headerchanger_IndexController extends Mage_Core_Controller_Front_Action{
   public function sendemailAction()
        //Fetch submited params
        $params = $this->getRequest()->getParams();
        $firstName = $this->getRequest()->getParams('First-Name');
        $lastName = $this->getRequest()->getParams('Last-Name');
        $email = $this->getRequest()->getParams('Email');
        $fullName = $firstName.' '. $lastName;

        $result = array_filter($params, 'strlen' );
        $str = '<table><tr><th>Field:</th><th>Value:</th></tr>';
        foreach($result as $key => $value){
        $str .='<tr>';
        $str .=  '<td>'.$key.':</td><td>'.$value.'</td>';
        $str .= '</tr>';

        $str .=  '</table>';    
        $mail = Mage::getModel('core/email');
        $mail->setSubject('Pre-Employment Application');
        $mail->setType('html');// You can use 'html' or 'text'
        try {
            Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
        catch(Exception $ex) {
            Mage::getSingleton('core/session')->addError('Unable to send email.');


        //Redirect back to index action of (this) inchoo-simplecontact controller


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.