codeigniter email发送成功,但收件箱中未收到电子邮件

时间:2016-10-07 05:45:16

标签: php codeigniter email

我正在尝试使用附件发送电子邮件。我的功能正常,但收件箱中未收到邮件。我的功能看起来像:

<?php
public function career()
{
    $config['upload_path'] = './assets/uploads';
    $config['allowed_types'] = 'docx|pdf';
    $config['max_size'] = '2000';
    $config['max_width']  = '';
    $config['max_height']  = '';
    $config['overwrite'] = FALSE;
    $config['remove_spaces'] = TRUE;    
    $this->load->library('upload', $config);
    $result = $this->upload->do_upload();
    if ($result)
    {
        $fileInfo=$this->upload->data();
        $this->load->library('form_validation');
        $this->form_validation->set_rules('specialization', 'specialization', 'trim|required');
        $this->form_validation->set_rules('name', 'name', 'trim|required');
        $this->form_validation->set_rules('email', 'email', 'trim|required');
        if($this->form_validation->run() == FALSE)
        {
            $this->index();
        }
        else
        {
            $path =  base_url('assets/uploads/'.$fileInfo['file_name']);
            $specialization = $this->input->POST('specialization', TRUE);
            $name = $this->input->POST('name', TRUE);
            $email = $this->input->POST('email', TRUE);
            $this->load->library('email');
            $this->email->from($email, $name);
            $this->email->to('name@gmail.com');
            $this->email->subject('Resume');
            $this->email->message($specialization);
            $this->email->attach($path);
            $results=$this->email->send();
            if($results)
            {
                $this->index();
            }
        }
    }
    else
    {
        $error = array('error' => $this->upload->display_errors());
        $this->index();
    }
}
?>

$this->email->send(); is working fine and get redirected to the $this->index(); function. but the email is not received. How to solve this? 

0 个答案:

没有答案
相关问题