修改邮件设置和发送配置

This commit is contained in:
Li Jianxuan 2014-03-07 03:21:59 +00:00
parent 02e12c01ae
commit 9b946942d9
4 changed files with 327 additions and 327 deletions

View File

@ -20,7 +20,7 @@ return array(
'port' => 994,
'ssl' => 'tls',
'auth' => 'login',
'name' => '青海省生态综合数据网' //发件人
),
'template'=> array(
'register' => 'member-register', //注册

View File

@ -222,7 +222,7 @@ class AccountController extends AbstractActionController
}
//找回密码
function forgotpasswordAction()
public function forgotpasswordAction()
{
$submit = $this->params()->fromPost('submit');
$captcha = new Captcha();
@ -242,6 +242,7 @@ class AccountController extends AbstractActionController
$status = $account->getMyPassword($email);
if(isset($status['error']) && !empty($status['error']))
{
$this->ViewModel->setVariable('captcha', $captcha->setCaptcha());
$this->ViewModel->setVariable('error',$status['error']);
return $this->ViewModel;
}else{
@ -255,7 +256,7 @@ class AccountController extends AbstractActionController
}
//重置密码
function getpasswordAction()
public function getpasswordAction()
{
$submit = $this->params()->fromPost('submit');
$salt = $this->params()->fromQuery('salt');

View File

@ -12,7 +12,6 @@ use Zend\Mail\Transport\SmtpOptions;
class Mail
{
private $db; //传入PDO对象.
private $conf; //邮件设置
private $config; //站点设置
private $email_cfg;
@ -50,24 +49,23 @@ class Mail
private function loadconf()
{
$this->conf->name = $this->config->site_title;
$email_cfg = Config::get('email');
$this->email_cfg = $email_cfg->config;
}
private function smtp()
{
$this->transport = new SmtpTransport();
$this->email_cfg = $email_cfg = Config::get('email');
$options = new SmtpOptions(array(
'name' => $email_cfg->hostname,
'host' => $email_cfg->host,
'port' => $email_cfg->port, // Notice port change for TLS is 587
'connection_class' => $email_cfg->auth,
'name' => $this->email_cfg->hostname,
'host' => $this->email_cfg->host,
'port' => $this->email_cfg->port, // Notice port change for TLS is 587
'connection_class' => $this->email_cfg->auth,
'connection_config' => array(
'username' => $email_cfg->username,
'password' => $email_cfg->password,
'ssl' => $email_cfg->ssl,
'username' => $this->email_cfg->username,
'password' => $this->email_cfg->password,
'ssl' => $this->email_cfg->ssl,
),
));
@ -77,7 +75,7 @@ class Mail
//设置默认发件人
public function setDefaultForm()
{
$this->mail->setFrom($this->email_cfg->username,$this->conf->name);
$this->mail->setFrom($this->email_cfg->username,$this->email_cfg->name);
}
//加载模板

View File

@ -307,9 +307,10 @@ class Account implements EventManagerAwareInterface
$salt = md5($email.'---'.$row[$this->conf->field->uname]);
$sql = "UPDATE {$this->conf->table->member} SET salt='$salt' WHERE id={$row['id']}";
//view::Dump($sql);
$state = $this->db->exec($sql);
if($state<1)
if($state < 1)
{
return array('error'=>"处理中出现错误,请重试",'place'=>'email');
}