我正在尝试使用以下CodeIgniter代码从wampserver" localhost"发送电子邮件到我的Gmail帐户。
public function emailsent_info()
{
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'XXXXXXX@gmail.com',
'smtp_pass' => 'XXXXXXX',
);
$this->load->library('email',$config);
//$this->email->set_newline("\r\n");
$this->email->from('deepak.keynes@gmail.com', 'Deepak Saar');
$this->email->to('deepak.keynes@gmail.com');
$this->email->subject('Matters Mostly Good');
$this->email->message('Its Working Now, Great');
if($this->email->send())
{
echo 'Your Email Sent Successfully';
}
else
{
echo $this->email->print_debugger();
}
答案 0 :(得分:0)
如果没有某些配置,您无法从本地主机发送电子邮件,
当我在本地主机编码时,我个人使用SMTP4DEV
如果您坚持发送真实的电子邮件,这可能会帮助您:CONFIGURE SENDMAIL WITH WAMP