codeigniter发送电子邮件不起作用

时间:2014-07-07 14:40:47

标签: codeigniter

此代码将发送一个url和密钥以验证注册。问题是显示"此电子邮件已发送",但是当我查看我的电子邮件时,没有关于验证的邮件。我的代码有问题吗?或者在发送电子邮件之前我是否需要先拥有域名。

 $key = md5(uniqid());
        $this->load->library('email', array('mailtype'=>'html'));
        $this->load->model('model_users');



        $this->email->from('tatinheartcoi@yahoo.com');
        $this->email->to($this->input->post('email'));
        $this->email->subject("Confirm your account.");

        $message = "<p> Thank you for signing up! </p>";
        $message = "<p><a href='".base_url()."main/register_user/$key' > Click here                    
        </a> to confirm account</p>";

        $this->email->message($message);

        if($this->model_users->add_users($key)){

         //send and email to the user
        if($this->email->send()){
            echo "This email has been sent!";
        }
        else{
            echo "Could not send the email.";
        }

        }
        else{
            echo "Problem adding to Database";

        }
    }
    }

    else{

        $this->load->view('view_signup');
    }

0 个答案:

没有答案