修改邮件设置和发送配置
This commit is contained in:
parent
02e12c01ae
commit
9b946942d9
|
@ -20,7 +20,7 @@ return array(
|
||||||
'port' => 994,
|
'port' => 994,
|
||||||
'ssl' => 'tls',
|
'ssl' => 'tls',
|
||||||
'auth' => 'login',
|
'auth' => 'login',
|
||||||
|
'name' => '青海省生态综合数据网' //发件人
|
||||||
),
|
),
|
||||||
'template'=> array(
|
'template'=> array(
|
||||||
'register' => 'member-register', //注册
|
'register' => 'member-register', //注册
|
||||||
|
|
|
@ -222,7 +222,7 @@ class AccountController extends AbstractActionController
|
||||||
}
|
}
|
||||||
|
|
||||||
//找回密码
|
//找回密码
|
||||||
function forgotpasswordAction()
|
public function forgotpasswordAction()
|
||||||
{
|
{
|
||||||
$submit = $this->params()->fromPost('submit');
|
$submit = $this->params()->fromPost('submit');
|
||||||
$captcha = new Captcha();
|
$captcha = new Captcha();
|
||||||
|
@ -242,6 +242,7 @@ class AccountController extends AbstractActionController
|
||||||
$status = $account->getMyPassword($email);
|
$status = $account->getMyPassword($email);
|
||||||
if(isset($status['error']) && !empty($status['error']))
|
if(isset($status['error']) && !empty($status['error']))
|
||||||
{
|
{
|
||||||
|
$this->ViewModel->setVariable('captcha', $captcha->setCaptcha());
|
||||||
$this->ViewModel->setVariable('error',$status['error']);
|
$this->ViewModel->setVariable('error',$status['error']);
|
||||||
return $this->ViewModel;
|
return $this->ViewModel;
|
||||||
}else{
|
}else{
|
||||||
|
@ -255,7 +256,7 @@ class AccountController extends AbstractActionController
|
||||||
}
|
}
|
||||||
|
|
||||||
//重置密码
|
//重置密码
|
||||||
function getpasswordAction()
|
public function getpasswordAction()
|
||||||
{
|
{
|
||||||
$submit = $this->params()->fromPost('submit');
|
$submit = $this->params()->fromPost('submit');
|
||||||
$salt = $this->params()->fromQuery('salt');
|
$salt = $this->params()->fromQuery('salt');
|
||||||
|
|
|
@ -12,7 +12,6 @@ use Zend\Mail\Transport\SmtpOptions;
|
||||||
class Mail
|
class Mail
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象.
|
private $db; //传入PDO对象.
|
||||||
private $conf; //邮件设置
|
|
||||||
private $config; //站点设置
|
private $config; //站点设置
|
||||||
private $email_cfg;
|
private $email_cfg;
|
||||||
|
|
||||||
|
@ -50,24 +49,23 @@ class Mail
|
||||||
|
|
||||||
private function loadconf()
|
private function loadconf()
|
||||||
{
|
{
|
||||||
$this->conf->name = $this->config->site_title;
|
$email_cfg = Config::get('email');
|
||||||
|
$this->email_cfg = $email_cfg->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function smtp()
|
private function smtp()
|
||||||
{
|
{
|
||||||
$this->transport = new SmtpTransport();
|
$this->transport = new SmtpTransport();
|
||||||
|
|
||||||
$this->email_cfg = $email_cfg = Config::get('email');
|
|
||||||
|
|
||||||
$options = new SmtpOptions(array(
|
$options = new SmtpOptions(array(
|
||||||
'name' => $email_cfg->hostname,
|
'name' => $this->email_cfg->hostname,
|
||||||
'host' => $email_cfg->host,
|
'host' => $this->email_cfg->host,
|
||||||
'port' => $email_cfg->port, // Notice port change for TLS is 587
|
'port' => $this->email_cfg->port, // Notice port change for TLS is 587
|
||||||
'connection_class' => $email_cfg->auth,
|
'connection_class' => $this->email_cfg->auth,
|
||||||
'connection_config' => array(
|
'connection_config' => array(
|
||||||
'username' => $email_cfg->username,
|
'username' => $this->email_cfg->username,
|
||||||
'password' => $email_cfg->password,
|
'password' => $this->email_cfg->password,
|
||||||
'ssl' => $email_cfg->ssl,
|
'ssl' => $this->email_cfg->ssl,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -77,7 +75,7 @@ class Mail
|
||||||
//设置默认发件人
|
//设置默认发件人
|
||||||
public function setDefaultForm()
|
public function setDefaultForm()
|
||||||
{
|
{
|
||||||
$this->mail->setFrom($this->email_cfg->username,$this->conf->name);
|
$this->mail->setFrom($this->email_cfg->username,$this->email_cfg->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载模板
|
//加载模板
|
||||||
|
|
|
@ -307,9 +307,10 @@ class Account implements EventManagerAwareInterface
|
||||||
$salt = md5($email.'---'.$row[$this->conf->field->uname]);
|
$salt = md5($email.'---'.$row[$this->conf->field->uname]);
|
||||||
|
|
||||||
$sql = "UPDATE {$this->conf->table->member} SET salt='$salt' WHERE id={$row['id']}";
|
$sql = "UPDATE {$this->conf->table->member} SET salt='$salt' WHERE id={$row['id']}";
|
||||||
|
//view::Dump($sql);
|
||||||
$state = $this->db->exec($sql);
|
$state = $this->db->exec($sql);
|
||||||
|
|
||||||
if($state<1)
|
if($state < 1)
|
||||||
{
|
{
|
||||||
return array('error'=>"处理中出现错误,请重试",'place'=>'email');
|
return array('error'=>"处理中出现错误,请重试",'place'=>'email');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue