在我的本地环境中,电子邮件可以正常运行,但是一旦我转移到我的在线网站,smtp电子邮件就无法运行并显示超时错误。
这是我的config/email.php
文件:
<?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;
我使用Cpanel,我需要配置一些东西吗?
答案 0 :(得分:1)
smtp_host
应该更改
$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);