【发布时间】:2019-04-22 14:04:37
【问题描述】:
$config = array();
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = '***';
$config['smtp_pass'] = '***';
$config['smtp_port'] = 465;
$this->email->initialize($config);
$useremail = $result['email'];
$this->load->library('email',array("mailtype" => "html"));
$from = '******';
$this->email->from($from);
$this->email->to($useremail);
$base_url = base_url();
$subject = "App : Please validate your email";
$this->email->subject($subject);
$message = "Dear ${FirstName} ${LastName}! Welcome to app.\r\n\r\nRegards,\r\nTeam ";
$this->email->message($message);
if($this->email->send()){
echo 1;
}else{
echo 0;
}
我无法使用 smtp 发送电子邮件。请帮帮我。我不明白我哪里出错了。
【问题讨论】:
-
我在 Godaddy 服务器上工作。
-
省去一些麻烦,开始使用电子邮件类来处理电子邮件。我推荐 PHPMailer。它易于使用,您可以直接从脚本中加载它。
标签: php codeigniter smtp