Codeigniter3框架不会在邮件

时间:2017-11-16 09:47:16

标签: php codeigniter email

请不要将此问题标记为“类似”,因为我已尝试过所有内容。我有一个注册,用户收到他的邮件验证消息。但是,我收到这样的邮件

enter image description here

我该如何解决这个问题?

这是我的代码:

private $config = Array(
        'protocol' => 'smtp',           
        'smtp_host' => 'ssl://mail.wtf.az',
        'smtp_port' => 465,
        'smtp_user' => 'no-reply@wtf.az',
        'smtp_pass' => 'mypasss',
        'mailtype'  => 'html', 
        'charset'   => 'utf-8',
        'wordwrap' => TRUE
    );

function sendEmail($to_email)
    {
        $from_email = 'no-reply@wtf.az'; //change this to yours
        $subject = 'Verify Your Email Address';
        $data['link'] = 'https://wtf.az/test/user/verify/<?= md5($to_email); ?>';

        $message = $this->load->view('registration/mailing', $data, true);

        //send mail
        $this->email->set_header('Content-type', 'text/html');
        $this->email->from($from_email, 'WTF');
        $this->email->to($to_email);
        $this->email->subject($subject);
        $this->email->message($message);
        $this->email->set_newline("\r\n");
        $result = $this->email->send();
        return $result;
    }

1 个答案:

答案 0 :(得分:0)

请尝试$ this-&gt; email-&gt; set_mailtype(&#34; html&#34;);

function sendEmail($to_email)
{
    $from_email = 'no-reply@wtf.az'; //change this to yours
    $subject = 'Verify Your Email Address';
    $data['link'] = 'https://wtf.az/test/user/verify/<?= md5($to_email); ?>';

    $message = $this->load->view('registration/mailing', $data, true);

    //send mail
    $this->email->set_header('Content-type', 'text/html');
    $this->email->from($from_email, 'WTF');
    $this->email->to($to_email);
    $this->email->subject($subject);
    $this->email->message($message);
    $this->email->set_newline("\r\n");
    $this->email->set_mailtype("html");
    $result = $this->email->send();
    return $result;
}