CodeIgniter的发送邮件功能在localhost上有效,但在实时服务器上不起作用

时间:2019-03-13 07:38:54

标签: codeigniter email smtp

CodeIgniter的发送邮件功能在localhost上有效,但在实时服务器上不起作用。我该怎么办? 我正在使用gmail smtp,以下是详细信息。

class CI_Email {    
    public $useragent   = 'CodeIgniter';
    public $mailpath    = '/usr/sbin/sendmail'; // Sendmail path
    public $protocol    = 'ssmtp';      // mail/sendmail/smtp
    public $smtp_host   = 'ssmtp.gmail.com';
    public $smtp_user   = 'xxxx@gmail.com';
    public $smtp_pass   = 'xxxxx';
    public $smtp_port   = '465';
    public $smtp_timeout = 50;
    public $smtp_keepalive  = FALSE;
    public $smtp_crypto = 'ssl';
    public $wordwrap    = TRUE;
    public $wrapchars   = 76;
    public $mailtype    = 'html';
    public $charset    = 'UTF-8';
    public $alt_message = '';
    public $validate   = FALSE;
    public $priority   = 3; // Default priority (1 - 5)
    public $newline    = "\n";  // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
    public $crlf        = "\n";
    public $dsn     = FALSE;
    public $send_multipart  = TRUE;
    public $bcc_batch_mode  = FALSE;
    public $bcc_batch_size  = 200;
    protected $_safe_mode   = FALSE;
    protected $_subject    = '';
    protected $_body        = '';
    protected $_finalbody   = '';
    protected $_header_str  = '';
    protected $_smtp_connect = '';
    protected $_encoding    = '8bit';
    protected $_smtp_auth   = true;
    protected $_replyto_flag = FALSE;
    protected $_debug_msg   = array();
    protected $_recipients  = array();
    protected $_cc_array    = array();
    protected $_bcc_array   = array();
    protected $_headers    = array();
    protected $_attachments = array();
    protected $_protocols   = array('mail', 'sendmail', 'smtp');
    protected $_base_charsets = array('us-ascii', 'iso-2022-');
    protected $_bit_depths  = array('7bit', '8bit');
    protected $_priorities = array(
        1 => '1 (Highest)',
        2 => '2 (High)',
        3 => '3 (Normal)',
        4 => '4 (Low)',
        5 => '5 (Lowest)'
    );
}

我缺少什么或做错了什么?请提出建议。预先感谢

1 个答案:

答案 0 :(得分:0)

您在服务器上的extension=php_openssl.dll中启用了扩展名php.ini吗?如果不是,请移除;,然后再次检查。

相关问题