2 Comments

  • swati

    hi i tried this but email are not sent.
    i tried as follows in my controller.
    —————————————————————————————————–
    public function UpdateinfoAction() {

    $email = $this->getRequest()->getParam(’email’);
    $number = $this->getRequest()->getParam(‘number’);
    $comment = $this->getRequest()->getParam(‘comment’);
    $data = array(
    ’email’ => $email,
    ‘number’ => $number,
    ‘comment’ => $comment
    );
    $model = Mage::getModel(‘contactus/contactus’); //for eg. Mage::getModel(‘catalog/product’);
    try {
    $model->setData($data)
    ->save();
    $jsonData = json_encode(array(‘error’ => false));
    $this->getResponse()->setHeader(‘Content-type’, ‘application/json’);
    $this->getResponse()->setBody($jsonData);
    } catch (Exception $e) {
    echo $e->getMessage();
    }
    $storeId=Mage::app()->getStore()->getId();
    $Vendor=Mage::getModel(‘contactus/contactus’)->load(8);

    /** @var $mailer Mage_Core_Model_Email_Template_Mailer */
    $mailer = Mage::getModel(‘core/email_template_mailer’);
    $emailInfo = Mage::getModel(‘core/email_info’);
    $emailInfo->addTo((string)$Vendor->getEmail(),(string) $Vendor->getName());
    $mailer->addEmailInfo($emailInfo);
    // Set all required params and send emails
    $mailer->setSender(array(’email’=>(string) ‘[email protected]’,’name’=> (string)’swati’));
    $mailer->setStoreId($storeId);
    $mailer->setTemplateId((string) ‘contactus_email_template’);
    $mailer->setTemplateParams(array(‘contactus’=>$Vendor));
    $mailer->send();
    }

    —————————————————————————

    Please help me

Leave a Reply

Your email address will not be published. Required fields are marked *