2016-08-04 69 views
0

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

 $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'); 
+0

wt是你的代码应该显示我吗? –

+0

是否添加了$ this-> email-> set_newline(“\ r \ n”);试着让我们知道 –

+0

@GoldunoSupport根本没有意义,我不认为这是一个代码相关的问题。由于codeigniter不使用任何排队或类似的东西。 – Jordy

回答

0

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

那么这段代码:

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

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

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

我希望这会为你工作。

0

它没有代码点火器库的问题可能是你的服务器smtp连接工作缓慢。如果你使用Linux然后尝试确认

$ sudo易于得到安装传家宝 - mailx的

回声“这是邮件正文和包含消息” | mailx -v -r“[email protected]”-s“这是主题”-S smtp =“mail.example.com:587”-S smtp-use-starttls -S -Smtp-auth = login -S smtp -auth用户= “[email protected]” -S SMTP-AUTH-密码= “ABC123” -S SSL的验证=忽略[email protected]

为多个校验 http://www.binarytides.com/linux-mail-with-smtp/

和校验它交付快还是慢?