1

这是我在控制器中的代码

$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!'; 

我的问题是,每次我发送邮件时,它都显示“电子邮件已发送”,但它从未到达我的收件箱。令我惊讶的是我在垃圾邮件中发现了这封电子邮件..谁能帮我摆脱这个该死的问题

4

1 回答 1

0

您没有发送标头,这就是为什么电子邮件正在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;

        );
于 2013-06-20T13:44:50.453 回答