Php 使用CodeIgniter的Gmail SMTP
我正在使用CodeIgniter邮件类库为Gmail SMTP邮件发送使用以下设置:![gmail设置][1]Php 使用CodeIgniter的Gmail SMTP,php,codeigniter,smtp,Php,Codeigniter,Smtp,我正在使用CodeIgniter邮件类库为Gmail SMTP邮件发送使用以下设置:![gmail设置][1] Mail Server* : smtp.gmail.com Username* : my@gmail.com Password* : ********** Port* : 567 SMTP_crypto* : TLS From Address* : my@gmail.com Reply To* : my@gmail.com 但它给了我以下错误: 遇到以下SMTP错误:110连接超时
Mail Server* : smtp.gmail.com
Username* : my@gmail.com
Password* : **********
Port* : 567
SMTP_crypto* : TLS
From Address* : my@gmail.com
Reply To* : my@gmail.com
但它给了我以下错误:
遇到以下SMTP错误:110连接超时无法发送数据:身份验证登录无法发送身份验证登录命令。
错误:无法发送数据:邮件发件人:发件人:以下SMTP
遇到错误:无法将数据:RCPT发送到
遇到以下SMTP错误:无法发送数据:数据:
遇到以下SMTP错误:无法发送数据:
用户代理:CodeIgniter日期:2014年11月11日星期二12:11:22+0300发件人:
高尔泰克员工返回路径:回复:高尔泰克员工至:
xxxx@gmail.com主题:=?utf-8?Q?你好?=X发送方:
xxxx@gmail.comX-Mailer:CodeIgniter X-Priority:1最高
邮件ID:Mime版本:1.0内容类型:
text/html;charset=utf-8内容传输编码:引用可打印
版权所有©2014邮寄系统,保留所有权利
无法发送数据:
遇到以下SMTP错误:无法使用发送电子邮件
PHP SMTP。您的服务器可能未配置为使用此
方法用户代理:CodeIgniter日期:2014年11月11日星期二12:11:22+0300
发件人:高尔泰克员工返回路径:回复至:高尔泰克员工至:
xxxx@gmail.com主题:=?utf-8?Q?你好?=X发送方:
xxxx@gmail.comX-Mailer:CodeIgniter X-Priority:1最高
消息ID:Mime版本:1.0
内容类型:text/html;字符集=utf-8内容传输编码:
引用可打印Hello
Reena版权所有©2014邮寄系统,所有权利
保留的
将端口587与TLS结合使用,或将端口465与SSL结合使用。在发送邮件的函数中尝试以下操作: 希望它能起作用
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'abc@gmail.com',
'smtp_pass' => 'abcd',
);
$message = 'Your mail message here.';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->clear();
$this->email->from('abc@gmail.com');
$this->email->to('abc@gmail.com'); //To whom you are sending.
$this->email->subject('Your mail subject');
$this->email->message($message);
if($this->email->send())
{
return true;
}
else
{
return false;
}
}
实际上这是一个库编码错误。我已使用以下链接修复了它:
Gmail使用传出smtp端口587进行tls连接。Gmail阻止使用其smtp进行访问。但是,即使我在此页面中启用了设置:它也不起作用。也许你仍然需要更改IMAP设置。我知道为SMTP激活此设置听起来可能有些奇怪:登录到你的Gmail或Google Apps电子邮件设置,然后:单击转发/IMAP选项卡并向下滚动到IMAP访问部分:IMAP必须启用。邮件中出现错误密码。我尝试使用其他代码,效果很好。