![](/img/trans.png)
[英]Sending email from localhost using xampp to gmail with Codeigniter
[英]Sending mail (in Localhost) with CodeIgniter email() library from gmail does not work
我已將codeIgniter email()設置為從我的Google帳戶發送電子郵件,但發生錯誤。 它不起作用,表示無法連接到服務器或服務器方未響應。
我已經在php.ini中啟用(未注釋)這些擴展:
extension=php_sockets.dll
extension=php_openssl.dll
這是我的CI配置:
$configs = array(
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.gmail.com',
'smtp_user'=>'cgmaster.iran@gmail.com',
'smtp_pass'=>"PASSWORD",
'smtp_port'=>'456'
);
$this->load->library("email", $configs);
$this->email->set_newline("\r\n");
$this->email->to("mostafatalebi@rocketmail.com");
$this->email->from("cgmaster.iran@gmail.com", "Mostafa Talebi");
$this->email->subject("This is bloody amazing.");
$this->email->message("Body of the Message");
if($this->email->send())
{
echo "Done!";
}
else
{
echo $this->email->print_debugger();
}
這是我得到的錯誤的第一行:
The following SMTP error was encountered: 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
您正在使用什么版本的CI? 如果是2.1.4,則您的配置數組中存在差異。 嘗試這個:
$configs = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_user' => 'cgmaster.iran@gmail.com',
'smtp_pass' => 'PASSWORD',
'smtp_port' => '465'
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.