douhe6181 2016-02-01 20:16
浏览 42

CodeIgniter 3的SMTP超时错误

In my local environment the email works, but once I transfer to my online website, the smtp email does not work and shows timeout error.

This is my config/email.php file:

<?php defined('BASEPATH') OR exit('No direct script access allowed.');

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '[email]';
$config['smtp_pass'] = '[password]';
$config['smtp_timeout'] = 30;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;

I use Cpanel, do I need to configure something?

  • 写回答

1条回答 默认 最新

  • doulou9927 2016-02-01 20:27
    关注

    smtp_host should change

    $config['protocol'] = 'smtp';
    $config['smtp_host'] = 'ssl://smtp.googlemail.com';
    $config['smtp_port'] = 465;
    $config['smtp_user'] = $sender_email;
    $config['smtp_pass'] = $sender_password;
    $config['mailtype'] = 'html';
    $config['charset'] = 'utf-8';
    $config['wordwrap'] = TRUE;
    $this->load->library('email', $config);
    
    评论

报告相同问题?