问题描述
我有一些问题,我不明白..
这是我的代码
i have some problem and i don't understand..this is my code
$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');
$message = $data->nama_depan.'<br>'.$this->input->post('snk');
$this->email->subject($message);
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
2个电子邮件都是有效的电子邮件..
that 2 email are active email..
,调试器的结果为
用户代理:CodeIgniter日期:Mon,2 Jun 2014 07:53:21 + 0200 From:
Your Name返回路径:To:[email protected]主题:
=?iso-8859-1?Q?Riyanto test?=
=?iso- 8859-1?Q ?? = Reply-To:[email protected]:[email protected] X-Mailer:CodeIgniter X-Priority:3
-ID:< [email protected]> Mime-Version:1.0
User-Agent: CodeIgniter Date: Mon, 2 Jun 2014 07:53:21 +0200 From: "Your Name" Return-Path: To: [email protected] Subject: =?iso-8859-1?Q?Riyanto test?= =?iso-8859-1?Q??= Reply-To: "[email protected]" X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0
Content-Type:text / plain; charset = iso-8859-1
Content-Transfer-Encoding:8bit
Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
测试电子邮件类。
推荐答案
In Codeigniter,Try this
$this->load->library('email');
$config['protocol']='smtp';
$config['smtp_host']='your host';
$config['smtp_port']='465';
$config['smtp_timeout']='30';
$config['smtp_user']='your mail id';
$config['smtp_pass']='your password';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('[email protected]', 'Site name');
$this->email->to('to-address-mail-id');
$this->email->subject('Notification Mail');
$this->email->message('Your message');
$this->email->send();
在 $ config ['smtp_user']
字段,请输入您的email_id并在 $ config ['smtp_pass']
字段中输入您的密码。
In $config['smtp_user']
field,give your email_id and in $config['smtp_pass']
field,provide your password for that mail..
这将工作。
希望这将解决你的问题..
This will work.Just try it.Hope this will solve your problem..
这篇关于codeigniter localhost电子邮件不发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!