Magento定制联系表

时间:2015-11-13 13:54:22

标签: php forms magento contact-form

我创建了一个单独的联系表单,此表单将收集的信息发送到电子邮件,收集数据似乎正常,发送电子邮件...但收集的信息不会发送到电子邮件,我'我只是获取静态内容作为测试,但收集的信息丢失,我尝试了不同的东西,这是我在控制器中的代码,我评论了每个使用的方法。

    <?php 
class Yo_Wholesaleform_IndexController extends Mage_Core_Controller_Front_Action{
    public function indexAction(){ 
        $this->loadLayout();
        $this->_initLayoutMessages('core/session'); 
        $this->renderLayout();
    }
    public function sendAction(){
        $post = $this->getRequest()->getPost();
             //i've tried this method
        $company_name = trim($post['company_name']);
             //also this method
        $company_name = $post['company_name'];
        $first_name = $post['first_name'];
        $last_name = $post['last_name'];
        $fullName = $first_name." ".$last_name;
        $formcontent = " From: $fullName 
        \n Company: $company_name
        \n Email: $email"; //here 
        $recipient = "alex@nalashandmade.com";
        $subject = "Wholesale Account Request";
        $mailheader = "From: $email \r\n";
        mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");


        Mage::getSingleton('core/session')->addSuccess($this->__('Thanks for submitting your Wholesale Account Request. Allow us 48 hours to review your information.'));//add success message.
        $this->_redirect('*/*');
    }
}

0 个答案:

没有答案