【发布时间】:2015-11-30 12:46:11
【问题描述】:
你好,我必须在本地主机上发送电子邮件 以下是我的配置文件
$config['useragent'] = "CodeIgniter";
$config['mailpath'] = "/usr/sbin/sendmail -t -i";
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'xyz.com'; //change this
$config['smtp_port'] = '465';
$config['smtp_user'] = 'xyz.com'; //change this
$config['smtp_pass'] = '######'; //change this
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard
我为电子邮件发送代码创建代码
if(count($result) > 0 || $result != NULL){
$password=$result['password'];
$this->load->library('email');
$from='chirag@site.com';
$to=$email;
$subject='forget password';
$this->email->from($from);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($password);
if($this->email->send()){
$this->session->set_flashdata('email','We sent your password to your Email...!');
redirect('login');
}
else{
echo $this->email->print_debugger();
}
}
但是当我发送电子邮件时出现以下错误
The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
那么有什么问题吗? 请帮我解决
【问题讨论】:
-
您的主机/用户/通行证是否有效(确定)以及尝试发送电子邮件的代码在哪里..?
-
是的,都是有效的主机、用户、密码
标签: php codeigniter email