我正在为我的 android 应用程序开发网络服务,但我的电子邮件功能很难正常工作。我按照本教程在这里。
在我的控制器中我有这个:
function forgotPassword_get(){
$this->load->model('model');
$this->response->format = 'json';
$email = $this->get('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
// gmail specific settings here
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = 'my email here';
$config['smtp_pass'] = 'password here';
$config['smtp_port'] = '465';
$config['wordwrap'] = TRUE;
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('mailfrom', 'sample name');
$this->email->to('mailto');
$this->email->subject('sample email');
$this->email->message('sample message for email.');
$this->email->send();
echo $this->email->print_debugger();
}
结果是
Your message has been successfully sent using the following protocol: sendmail
User-Agent: CodeIgniter
Date: Tue, 29 Oct 2013 15:45:57 +0800
From: "sample name"
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <526f67b5f16b8@mobilemo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
sample message for email.
它说电子邮件已成功发送,但我认为邮件没有到达我的收件箱。
谁能帮助我,我想我错过了一些东西。提前致谢。