...
|
...
|
@@ -121,13 +121,32 @@ class Home extends Base { |
|
|
|
|
|
$email = $this->getEmail();
|
|
|
|
|
|
$yzemail = function(&$value,$field){
|
|
|
if($value){
|
|
|
if(!is_array($value)){
|
|
|
if(@json_decode($value,true)){
|
|
|
$value = json_decode($value,true);
|
|
|
}else{
|
|
|
$value = [['email'=>$value,'name'=>'']];
|
|
|
}
|
|
|
}
|
|
|
foreach ($value as $item){
|
|
|
if(!Verify::sEmail($item['email'])){
|
|
|
app()->e([$field.'_verify_error',$item['email']]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$formData = Verify::checks([
|
|
|
'nickname|'.__('nickname') => ['required','max'=>50],
|
|
|
'subject|'.__('subject') => ['required','max'=>150],
|
|
|
'body|'.__('body_email') => ['required'],
|
|
|
'to|'.__('to_email') => ['required','array|string','email'],
|
|
|
'tos|'.__('to_email') => ['required',$yzemail],
|
|
|
'cc|'.__('to_cc') => [$yzemail],
|
|
|
'bcc|'.__('to_bcc') => [$yzemail],
|
|
|
'priority|'.__('priority_email') => ['in'=>[1,3,5]],
|
|
|
'files|'.__('files_email') => [
|
|
|
'attachment|'.__('files_email') => [
|
|
|
'file'=>[
|
|
|
'ext' => [],
|
|
|
'size' => 500,
|
...
|
...
|
@@ -144,10 +163,10 @@ class Home extends Base { |
|
|
$email['email'],
|
|
|
base64_decode($email['password']),
|
|
|
$formData['nickname']??'',
|
|
|
$formData['to'],
|
|
|
$formData['tos'],
|
|
|
$formData['subject'],
|
|
|
$formData['body'],
|
|
|
$formData['files']??'',
|
|
|
$formData['attachment']??'',
|
|
|
$formData['receipt']??'',
|
|
|
$formData['priority']??3,
|
|
|
);
|
...
|
...
|
@@ -377,6 +396,34 @@ class Home extends Base { |
|
|
$body = db()->first(bodySql::first($id));
|
|
|
if($body){
|
|
|
$data['body'] = json_decode($body['text_html'],true);
|
|
|
$charset = '';
|
|
|
foreach ($data['body'] as $bd){
|
|
|
if(!empty($bd['charset'])){
|
|
|
$charset = $bd['charset'];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
foreach ($data['body'] as $bdk=>$bd){
|
|
|
|
|
|
if(!empty($bd['path'])){
|
|
|
|
|
|
if($charset){
|
|
|
$data['body'][$bdk]['name'] = @iconv($charset,'utf-8',@base64_decode($bd['name']));
|
|
|
$data['body'][$bdk]['filename'] = @iconv($charset,'utf-8',@base64_decode($bd['filename']));
|
|
|
}
|
|
|
|
|
|
$data['body'][$bdk]['size'] = 0;
|
|
|
$data['body'][$bdk]['url'] = '';
|
|
|
if(is_file($bd['path'])){
|
|
|
// 文件大小
|
|
|
$data['body'][$bdk]['size'] = filesize($bd['path']);
|
|
|
// 文件访问地址
|
|
|
$data['body'][$bdk]['url'] = APP_HOST.str_replace(PUBLIC_PATH,'',$bd['path']);
|
|
|
}
|
|
|
|
|
|
unset($data['body'][$bdk]['path']);
|
|
|
}
|
|
|
}
|
|
|
return [
|
|
|
'data' => $data
|
|
|
];
|
...
|
...
|
|