Codeigniter Mail功能将邮件发送到垃圾邮件文件夹 [英] Codeigniter Mail function sends mail to spam folder

查看:93
本文介绍了Codeigniter Mail功能将邮件发送到垃圾邮件文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用codeigniter邮件功能。它完美发送邮件。但是所有时间都将邮件发送到垃圾邮件文件夹。我该如何克服这个问题。



功能

  function msg_now(){
$ this-> load-> library('email');
$ this-> load-> library(’parser’);

$ config ['protocol'] ='sendmail';
$ config ['wordwrap'] = TRUE;
$ config [‘mailtype’] =‘html’;
$ this->电子邮件-> initialize($ config);
$email_id='test@test.com';
$ name = $ this->测试;
$ this-> email-> from(’test@gmail.com’);
$ this-> email->至($ email_id);

$ this->电子邮件->主题(测试主题);

$ this->电子邮件->消息(< p> Lorem ipsum虚拟内容< / p>);
$ this->电子邮件-> send();
}


解决方案

有很多原因发送邮件进入垃圾邮件,但简单的解决方案是在发送邮件之前设置邮件标题并赋予其优先级。该函数是 set_header()

  $ this-> email -> set_header($ header,$ value); 

还请检查此链接供参考。



对我一直有效。


I am using codeigniter mail function. Its sends mail perfectly. But all the time mail going to the spam folder. How can I overcome this.

Function

function msg_now(){
        $this->load->library('email');
        $this->load->library('parser');

        $config['protocol'] = 'sendmail';
        $config['wordwrap'] = TRUE;
        $config['mailtype'] = 'html';
        $this->email->initialize($config);
        $email_id='test@test.com';
        $name=$this->'test';
        $this->email->from('test@gmail.com');
        $this->email->to($email_id);

        $this->email->subject('Test subject');

        $this->email->message("<p>Lorem ipsum dummy content</p>");
        $this->email->send();
}

解决方案

There are many reasons for mail to go in spam, but easy solution for it is to set the headers of the mail before sending and giving it priority.

Here's how to do that in CodeIgniter. The function is set_header():

$this->email->set_header($header, $value);

also check this link for reference.

It has always worked for me.

这篇关于Codeigniter Mail功能将邮件发送到垃圾邮件文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆