简体   繁体   English

我在使用Codeigniter电子邮件库发送邮件时出错

[英]I am having error in sending mail using Codeigniter email library

Here is my code in Controller 这是我在Controller中的代码

$this->load->library('email');
$config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'kyaw@official-crystal.com',
            'smtp_pass' => 'password'
        );

$this->load->library('email', $config);
$this->email->set_newline("\r\n");

$this->email->from('kyaw@official-crystal.com', 'Kyaw Swar');
$this->email->to('novicewebdeveloper@gmail.com');

$this->email->subject(' CodeIgniter Rocks Socks ');
$this->email->message('Hello World');


if (!$this->email->send())
    show_error($this->email->print_debugger());
else
    echo 'Your e-mail has been sent!'; 

My problem is that everytime when i send the mail , it show that "The email has been sent" but it never arrive in my inbox .Much to my suprise is i found this email in SPAM .. can anybody help me out of this damn problem 我的问题是,每当我发送邮件时,都会显示“电子邮件已发送”,但是却从未到达我的收件箱。令我惊讶的是,我在SPAM中发现了这封电子邮件..任何人都可以帮我解决这个问题问题

You are not sending headers thats why email is receving in SPAM Try editing this: 您没有发送标头,这就是为什么在SPAM接收电子邮件的原因尝试编辑以下内容:

$config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'kyaw@official-crystal.com',
            'smtp_pass' => 'password',
             'mailtype' => 'html',
            'mailpath' => '/usr/sbin/sendmail',
            'charset' => 'iso-8859-1',
             'wordwrap' => TRUE;

        );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM