|
...
|
...
|
@@ -69,13 +69,11 @@ class EmailController extends BaseController |
|
|
|
public function set_smtp(Smtp $smtp)
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id' => ['required'],
|
|
|
|
'email' => ['required', 'email', 'max:200'],
|
|
|
|
'password' => ['required', 'max:200'],
|
|
|
|
'host' => ['required', 'max:200', 'regex:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/'],
|
|
|
|
'from_name' => ['required', 'max:200'],
|
|
|
|
], [
|
|
|
|
'project_id.required' => '参数异常',
|
|
|
|
'email.required' => '邮箱必须',
|
|
|
|
'email.email' => '邮箱格式错误',
|
|
|
|
'password.required' => '授权码/密码必须',
|
|
...
|
...
|
@@ -83,7 +81,7 @@ class EmailController extends BaseController |
|
|
|
'host.regex' => 'smtp格式错误',
|
|
|
|
'from_name.required' => '发信人昵称必须',
|
|
|
|
]);
|
|
|
|
$info = $smtp->read(['project_id' => $this->param['project_id']]);
|
|
|
|
$info = $smtp->read(['project_id' => $this->project['id']]);
|
|
|
|
if (!$info) {
|
|
|
|
$smtp->add($this->param);
|
|
|
|
} else {
|
|
...
|
...
|
@@ -93,7 +91,7 @@ class EmailController extends BaseController |
|
|
|
}
|
|
|
|
|
|
|
|
public function get_smtp(Smtp $smtp){
|
|
|
|
$info = $smtp->read(['project_id' => $this->param['project_id']]);
|
|
|
|
$info = $smtp->read(['project_id' => $this->project['id']]);
|
|
|
|
$this->response($info);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|