enhance send method of Mail class

This commit is contained in:
printempw 2016-07-28 15:49:36 +08:00
parent 9ea7b15e9e
commit 74caacf6df
3 changed files with 13 additions and 11 deletions

View File

@ -138,7 +138,7 @@ class AuthController extends BaseController
$url = Option::get('site_url')."/auth/reset?uid={$uid}&token=$token";
$content = View::make('auth.mail')->with('reset_url', $url)->render();
if(!$mail->Send($content)) {
if(!$mail->content($content)->send()) {
View::json('邮件发送失败,详细信息:'.$mail->getLastError(), 2);
} else {
$_SESSION['last_mail_time'] = time();

View File

@ -55,17 +55,20 @@ class Mail
return $this->mailer->ErrorInfo;
}
public function content($content)
{
$this->mail->isHTML(true);
$this->mail->Body = $content;
return $this;
}
/**
* Send a mail
*
* @param string $body
* @return boolean
*/
public function send($body)
public function send()
{
$this->mail->isHTML(true);
$this->mail->Body = $body;
return $this->mail->send();
}

View File

@ -2,7 +2,7 @@
* @Author: printempw
* @Date: 2016-07-17 10:54:22
* @Last Modified by: printempw
* @Last Modified time: 2016-07-27 18:18:16
* @Last Modified time: 2016-07-28 15:44:31
*/
'use strict';
@ -84,9 +84,7 @@ $('#login-button').click(function() {
return false;
});
$('.captcha').click(function() {
$(this).attr('src', './captcha?' + new Date().getTime());
});
$('.captcha').click(freshCaptcha);
$('#register-button').click(function() {
@ -180,9 +178,10 @@ $('#forgot-button').click(function() {
success: function(json) {
if (json.errno == 0) {
showMsg(json.msg, 'success');
$('#forgot-button').html('发送').prop('disabled', '');
$('#forgot-button').html('发送').prop('disabled', 'disabled');
} else {
showMsg(json.msg, 'warning');
freshCaptcha();
$('#forgot-button').html('发送').prop('disabled', '');
}
},