首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用codeigniter发送电子邮件时的延迟

使用codeigniter发送电子邮件时的延迟
EN

Stack Overflow用户
提问于 2016-08-04 17:40:26
回答 2查看 1.2K关注 0票数 0

我使用的是codeigniter 3.x。问题是我可以使用codeigniter电子邮件库和smtp发送电子邮件,但电子邮件只能在4-10分钟后发送。我怎样才能缩短时间间隔。请给我一些建议。

代码语言:javascript
复制
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://smtp.googlemail.com';
        $config['smtp_user'] = 'myemail';/*email goes here*/
        $config['smtp_pass'] = 'mypass'; /*email pwd goes here*/
        $config['smtp_port'] = 465; 
        $config['smtp_timeout'] = 5;
        $config['wordwrap'] = TRUE;
        $config['charset'] = 'utf-8';
        $config['priority'] = 1;
        $this->load->library('email');
        $this->email->set_mailtype("html");
        $this->load->library('parser');


        $this->email->from('my mail');
        $this->email->to('tomail');

        $this->email->subject('subject');
        $this->email->message('message');
EN

回答 2

Stack Overflow用户

发布于 2016-08-04 19:08:24

首先检查错误日志和邮件服务是否正常工作。

然后你可以使用这段代码:

代码语言:javascript
复制
$ci = get_instance();
$ci->load->library('email');
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "abc@gmail.com"; 
$config['smtp_pass'] = "yourpassword";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";

$ci->email->initialize($config);

$ci->email->from('abc@gmail.com', 'abc');
$list = array('xxx@gmail.com');
$ci->email->to($list);
$this->email->reply_to('my-email@gmail.com', 'Explendid Videos');
$ci->email->subject('This is an email test');
$ci->email->message('It is working. Great!');
$ci->email->send();

我希望这对你有用。

票数 0
EN

Stack Overflow用户

发布于 2016-08-05 05:15:00

这不是代码点火器库的问题,可能是您的服务器smtp连接运行缓慢。以确认您是否使用linux,然后尝试

$ sudo apt-get install heirloom-mailx

echo“这是邮件正文,包含邮件”| mailx -v -r "someone@example.com“-S”这是主题“-S smtp="mail.example.com:587”-S smtp-use-starttls smtp-auth=登录-S smtp-auth-user="someone@example.com“-S smtp-auth-password="abc123”-S ssl-verify=ignore yourfriend@gmail.com

有关更多信息,请查看http://www.binarytides.com/linux-mail-with-smtp/

并检查它是快速交付还是缓慢交付?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38763788

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档