|
|
<?php
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
use App\Models\Email;
|
|
|
use App\Models\Host;
|
|
|
use Helper\Mail\Imap;
|
|
|
use Helper\Mail\Mail;
|
|
|
namespace Controller;
|
|
|
|
|
|
/**
|
|
|
* 提供邮件各项数据
|
|
|
* @author:dc
|
|
|
* @time 2023/2/4 11:18
|
|
|
* Class MailApi
|
|
|
* @package App\Http\Controllers
|
|
|
* @time 2023/2/13 11:28
|
|
|
* Class Home
|
|
|
* @package Controller
|
|
|
*/
|
|
|
class MailApi
|
|
|
{
|
|
|
class Home {
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 添加新的邮箱
|
|
|
* 登录操作
|
|
|
* @return int[]
|
|
|
* @author:dc
|
|
|
* @time 2023/2/4 15:37
|
|
|
* @time 2023/2/13 11:50
|
|
|
*/
|
|
|
public function login(){
|
|
|
// $mail,$password,$imap,$smtp
|
|
|
$formData = request()->only(['email','password','imap','smtp']);
|
|
|
// $mail,$password,$imap,$smtp
|
|
|
$formData = app()->request(['email','password','imap','smtp']);
|
|
|
|
|
|
if(empty($formData['email']) || !preg_match("",$formData['email'])){
|
|
|
app()->e('email_verify_error');
|
|
|
}
|
|
|
|
|
|
|
|
|
$validator = validator($formData,[
|
|
|
'email' => ['required','email'],
|
|
|
'password' => ['required','min:8','max:32'],
|
...
|
...
|
@@ -78,25 +79,6 @@ class MailApi |
|
|
'token' => token_en($model->id.','.$model->email.','.time())
|
|
|
])
|
|
|
->toJson();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 读取服务器上已记录的各个邮箱的服务器地址
|
|
|
* @author:dc
|
|
|
* @time 2023/2/4 15:12
|
|
|
*/
|
|
|
public function host(){
|
|
|
|
|
|
$host = Host::_all();
|
|
|
|
|
|
res()->data($host)->throw();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function lists(){
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|