Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 发送电子邮件时出错-CodeIgniter_Php_Codeigniter_Email - Fatal编程技术网

Php 发送电子邮件时出错-CodeIgniter

Php 发送电子邮件时出错-CodeIgniter,php,codeigniter,email,Php,Codeigniter,Email,我有下面发送电子邮件的代码,在这上面我得到了SMTP错误 遇到以下SMTP错误:10060由于连接方在一段时间后未正确响应,连接尝试失败,或者由于连接的主机未能响应,建立的连接失败 无法发送数据:验证登录 这是一个很长的错误,我刚刚提供了上半部分 code $frommail = "sharadrsoni@gmail.com"; $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.gmail.c

我有下面发送电子邮件的代码,在这上面我得到了
SMTP错误

遇到以下
SMTP错误
:10060由于连接方在一段时间后未正确响应,连接尝试失败,或者由于连接的主机未能响应,建立的连接失败

无法发送数据:验证登录

这是一个很长的错误,我刚刚提供了上半部分

code

$frommail            = "sharadrsoni@gmail.com";
$config['protocol']  = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'sharadrsoni@gmail.com';
$config['smtp_pass'] = 'pass'; //your smtp password
$config['mailtype']  = 'html';
$config['charset']   = 'iso-8859-1';
$config['wordwrap']  = TRUE;
$config['newline']   = "\r\n";

$this->email->initialize($config);
$this->email->from($frommail, $companyfullname);
$this->email->to($tomail);
$this->email->subject($subject);
$this->email->set_mailtype('html');
$this->email->message($MHtml);

$emailSent = $this->email->send();
我尝试了几种方法,但最后只显示了这个错误


我正在使用
CodeIgniter
version
2.1.0

参考:-我已经看过这篇文章,建议的更改已经完成。请看一看。请尝试使用$config['smtp_port']=587$config['smtp_secure']='tls'您尝试过使用其他端口吗?它可能会影响。。在我的示例中,我使用
$config['smtp\u port']=25
,尽管我使用的是不同的电子邮件库