Codeigniter Mail确实发送但无法接收

时间:2014-03-04 15:18:20

标签: php function codeigniter config

读了很多,我无法收到包含我的代码的邮件。它发送完美但我从未收到过电子邮件。可能有配置问题吗? provider = one.com

function sendmail(){

    $message = "Aanvraag van: ".$this->input->post('inputName')."\r\n\r\n";
    $message .= "Vraag: ".$this->input->post('inputVraag')."\r\n";
    $message .= "Telefoon nr: ".$this->input->post('inputTel')."\r\n";
    $message .= "Email: ".$this->input->post('inputEmail')."\r\n\r\n";
    $message .= "Bericht: ".$this->input->post('inputBericht')."\r\n\r\n";

        $config = array();
   $config['smtp_host'] = "send.one.com";
   $config['smtp_port'] = "25";
   $config['mailtype'] = 'html';
   $config['charset']  = 'utf-8';

        $this->load->library('email');
        $this->email->initialize($config);
        $this->email->from($this->input->post('inputEmail'),$this->input->post('inputName'));
        $this->email->to('anemailaddress@gmail.com');
        $this->email->subject('Aanvraag website');
        $this->email->message($message);

        if($this->email->send()){
            $this->session->set_flashdata('success','Danku voor uw email');
            redirect('welcome','refresh');  
        }

        echo $this->email->print_debugger();

    }

2 个答案:

答案 0 :(得分:0)

显示您的$ config。

您确定邮件服务器配置正确吗?

尝试使用这个简单的脚本发送邮件:

    <?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

@edit 新的灵魂: 尝试端口25并托管mailout.one.com

答案 1 :(得分:0)

只需添加$config,例如:

$config['charset'] = 'iso-8859-1';
$config['mailtype'] = 'text';
$this->email->initialize($config);
相关问题