无法在opencart中发送邮件

时间:2015-10-16 12:41:23

标签: opencart

我创建了一个名为request的新信息页面。在这里我添加了以下代码

{         $ mail = new Mail();

        $namess = $this->request->post['name'];
        $emailss = $this->request->post['email'];
        $phoness = $this->request->post['phone'];
        $phoness2 = $this->request->post['phone2'];
        $enquiryss = $this->request->post['enquiry'];
        $conve = $this->request->post['contactviae'];
        if($conve == '1')
        {
            $emailsss = "Yes";

        }
        else
        {
            $phonesss = "Yes";
        }
        if(!isset($emailsss)){
            $emailsss = "No";
        }
        if(!isset($phonesss)){
            $phonesss = "No";
        }

        echo $body = "Hello Admin <br/><br/> You have recieved a request for product. The details for your product is as follow : 
        <br/><br/><table border='1'><tr><td>Name</td><td>$namess</td></tr><tr><td>Email</td><td>$emailss</td></tr>
        <tr><td>Phone No</td><td>$phoness</td></tr><tr><td>Secondary Phone</td><td>$phoness2</td></tr><tr><td>Enquiry</td><td>$enquiryss</td></tr><tr><td>Contact Via Email</td><td>$emailsss</td></tr>
        <tr><td>Contact Via Phone</td><td>$phonesss</td></tr></table><br/><br/>Thanks & Regards";

        $mail->protocol = $this->config->get('config_mail_protocol');
        $mail->parameter = $this->config->get('config_mail_parameter');
        $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
        $mail->smtp_username = $this->config->get('config_mail_smtp_username');
        $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
        $mail->smtp_port = $this->config->get('config_mail_smtp_port');
        $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

        $mail->setTo($this->config->get('config_email'));
        $mail->setFrom($this->request->post['email']);
        $mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
        $mail->setSubject("Request a product");
        $mail->setHtml($body);

        $this->response->redirect($this->url->link('information/request/success'));}

但是在提交按钮后,它会重定向到成功页面但没有收到任何邮件。 Plz帮助我,我缺少什么

能够通过联系页面发送邮件

1 个答案:

答案 0 :(得分:0)

您是否在管理员中设置了电子邮件配置?它在System&gt;中设置&gt; (编辑商店)&gt;邮件