我想通過Codeigniter電子郵件庫形式發送電子郵件本地主機。以下是我的代碼。在codeigniter郵件發送錯誤
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'xxxxxx',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]');
$this->email->to('[email protected]');
$this->email->subject('Subject');
$this->email->message('Sample message');
if (!$this->email->send())
{
show_error($this->email->print_debugger());
}
else
{
echo 'Your e-mail has been sent!';
}
我收到以下錯誤: -
無法使用電子郵件PHP郵件()。您的服務器可能未配置爲使用此方法發送郵件。 &
嚴重性:警告
消息:電子郵件():無法連接在 「localhost」 的端口25的郵件服務器,驗證您的 「SMTP」 和 「SMTP_PORT」 在php.ini中設置或使用的ini_set()
文件名:庫/ Email.php
行號:1896年
回溯:
文件:d:\ XAMPP \ htdocs中\ AJAX \應用\控制器\ angular_http.php 行:29 功能:發送
文件:d:\ XAMPP \ htdocs中\ AJAX \的index.php 行:315 函數:require_once
現在使用此設置錯誤消失了,但郵件尚未發送。 –
請檢查端口25是否打開。 –