我正在開發我的android應用程序的web服務,我很難在我的電子郵件功能上運行良好。 我按照這個教程HERE。發送郵件在Rest客戶端(Codeigniter)
,並在我的控制器我有這樣的:
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: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
sample message for email.
它說,郵件發送成功,但我認爲郵件沒有到達我的收件箱。
任何人都可以幫助我,我想我錯過了一些東西。 在此先感謝。
正是我所做的。 – CaffeineShots