我嘗試發送郵件。它不提供任何錯誤,但它不提供郵件如何在php codeigniter中從localhost發送郵件?
$config['smtp_host'] = "ssl://smtp.googlemail.com";
$config['smtp_port'] = "456";
$config['smtp_user'] = "[email protected]";
$config['smtp_pass'] = "mypassword";
$this->email->initialize($config);
$message = "my message";
$this->email->from('[email protected]');
$this->email->to('[email protected]');
$this->email->subject('Testing');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
其返回「郵件發送」但郵件未送達
檢查您的垃圾郵件文件夾,並嘗試在配置中指定協議 –
在localhost中更改您的smtp設置php.ini文件使用gmail發送電子郵件 –