【发布时间】:2018-10-12 06:32:45
【问题描述】:
我使用下面的代码来发送电子邮件,但在本地和实时服务器中不起作用?
//this function sends a confirmation email to the user while registration
public function send_email($email,$message,$subject) {
// configuration
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'example@gmail.com',
'smtp_pass' => 'password',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('example@gmail.com');
$this->email->to($email);
$this->email->subject($subject);
$this->email->message($message);
$result = $this->email->send();
$this->email->clear();
return ($result);
}
【问题讨论】:
-
尝试使用不同的端口,例如 587。请将输出粘贴到此处。
-
不!它在端口 587 上不起作用
-
我的方法返回“1”,在我看来它发送了,但是当我在我的计算机中结帐时输出电子邮件文件夹是空的
-
请检查电子邮件是否被发送到垃圾邮件文件夹。
-
不!它们不在垃圾邮件文件夹中,我的配置设置是否正确?
标签: php codeigniter email backend mail-server