Php CodeIgniter电子邮件发送错误
我正在尝试用CodeIgniter发送电子邮件这里是我的代码Php CodeIgniter电子邮件发送错误,php,codeigniter,email,smtp,Php,Codeigniter,Email,Smtp,我正在尝试用CodeIgniter发送电子邮件这里是我的代码 function sendmail() { // Set SMTP Configuration $emailConfig = array( 'protocol' => 'smtp', 'smtp_host' => 'TLS://smtp.googlemail.com', 's
function sendmail()
{
// Set SMTP Configuration
$emailConfig = array(
'protocol' => 'smtp',
'smtp_host' => 'TLS://smtp.googlemail.com',
'smtp_port' => 587,
'smtp_user' => 'email@gmail.com',
'smtp_pass' => '******',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
// Set your email information
$from = array('email' => 'frommail@gmail.com', 'name' => 'Your Name');
$to = array('mymail@gmail.com');
$subject = 'Your gmail subject here';
$message = 'Type your gmail message here';
// Load CodeIgniter Email library
$this->load->library('email', $emailConfig);
// Sometimes you have to set the new line character for better result
$this->email->set_newline("rn");
// Set email preferences
$this->email->from($from['email'], $from['name']);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($message);
// Ready to send email and check whether the email was successfully sent
if (!$this->email->send()) {
// Raise error message
show_error($this->email->print_debugger());
}
else {
// Show success notification or other things here
echo 'Success to send email';
}
}
但它给了我这种类型的错误
遇到以下SMTP错误:110连接超时
无法发送数据:AUTH LOGIN无法发送AUTH LOGIN命令。
错误:无法发送数据:邮件发件人:
发件人:
遇到以下SMTP错误:无法发送数据:RCPT
致:
致:
遇到以下SMTP错误:无法发送数据:数据
数据:
遇到以下SMTP错误:无法发送数据:
用户代理:CodeIgniter日期:2016年1月29日星期五06:59:14+0000发件人:
“Alex Tester”返回路径:至:coderjack9@gmail.com主题:
=?iso-8859-1?Q?电子邮件测试?=回复:alextester1003@gmail.com“X-Sender:alextester1003@gmail.comX-Mailer:CodeIgniter X-Priority:3
(正常)消息ID:Mime版本:1.0
内容类型:多部分/备选;boundary=“B_ALT_56ab0dc2af809”
这是MIME格式的多部分消息。您的电子邮件应用程序
可能不支持此格式--B_ALT_56ab0dc2af809内容类型:
文本/纯文本;charset=iso-8859-1内容传输编码:8位测试
电子邮件类--B_ALT_56ab0dc2af809内容类型:text/html;
charset=iso-8859-1内容传输编码:引用可打印测试
电子邮件类。
--B_ALT_56ab0dc2af809--无法发送数据:
遇到以下SMTP错误:无法使用发送电子邮件
PHP SMTP。您的服务器可能未配置为使用此
方法
注意:邮件无法通过本地主机发送。如果您尝试使用live站点
注意:邮件无法通过本地主机发送。如果您尝试live站点。请使用此用户
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxx',
'smtp_pass' => 'xxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// Set to, from, message, etc.
$result = $this->email->send();
用户本
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxx',
'smtp_pass' => 'xxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// Set to, from, message, etc.
$result = $this->email->send();
我正在live server上尝试此功能我正在live server上尝试此功能