【发布时间】:2018-08-03 10:50:53
【问题描述】:
我目前正在使用 codeigniter 发送邮件,下面是 smtp 的详细信息,但我收到错误如何解决这个问题 stackoverflow 上的一些帖子要求在 php.ini 中进行一些修改仍然遇到同样的问题。
$config = Array(//for gmail Settings
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'xyz@gmail.com', // user details
'smtp_pass' => 'xyzxyz', // password
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_header('MIME-Version', '1.0; charset=utf-8');
$this->email->set_header('Content-type', 'text/html');
$this->email->set_newline("\r\n");
$this->email->from('xyz@gmail.com@gmail.com', 'xyz.com'); //sender's email
$this->email->to($email); // change it to yours
$this->email->subject('Password reset email');
$message = "<h2>You have requested to reset password</h2>";
$message .= "<a href='" . base_url('controller') . "/" . "methodname/" . $reset . "'> Click here to reset your password</a>";
$this->email->message($message);
$send = $this->email->send();
【问题讨论】:
-
您在 php.ini 中做了哪些更改
-
似乎电子邮件库未使用提供的配置初始化,并且正在使用来自
/application/config/email.php文件的配置
标签: php codeigniter email smtp