|
@@ -4,6 +4,8 @@ namespace Controller; |
|
@@ -4,6 +4,8 @@ namespace Controller; |
4
|
|
4
|
|
5
|
|
5
|
|
6
|
use Lib\Err;
|
6
|
use Lib\Err;
|
|
|
7
|
+use Lib\Imap\ImapConfig;
|
|
|
8
|
+use Lib\Imap\ImapPool;
|
7
|
use Lib\Mail\Mail;
|
9
|
use Lib\Mail\Mail;
|
8
|
use Lib\Mail\MailFun;
|
10
|
use Lib\Mail\MailFun;
|
9
|
use Model\folderSql;
|
11
|
use Model\folderSql;
|
|
@@ -157,27 +159,24 @@ class Folder extends Base { |
|
@@ -157,27 +159,24 @@ class Folder extends Base { |
157
|
app()->e('folder_is_exist');
|
159
|
app()->e('folder_is_exist');
|
158
|
}
|
160
|
}
|
159
|
|
161
|
|
160
|
- // 远程创建
|
|
|
161
|
- $mail = new Mail(
|
|
|
162
|
- $email['email'],
|
|
|
163
|
- base64_decode($email['password']),
|
|
|
164
|
- $email['imap']
|
|
|
165
|
- );
|
162
|
+ $email['password'] = base64_decode($email['password']);
|
|
|
163
|
+ $email['host'] = $email['imap'];
|
|
|
164
|
+ $imap = ImapPool::get(new ImapConfig($email));
|
166
|
|
165
|
|
167
|
- if($mail->login()!=1){
|
166
|
+ if($imap->login()->isOk()){
|
168
|
app()->e('login_error_imap');
|
167
|
app()->e('login_error_imap');
|
169
|
}
|
168
|
}
|
170
|
|
169
|
|
171
|
if($id){
|
170
|
if($id){
|
172
|
// 远程创建
|
171
|
// 远程创建
|
173
|
- $ret = $mail->client->folderRename($folder['origin_folder'],$origin_folder);
|
172
|
+ $ret = $imap->folder($folder['origin_folder'])->rename($origin_folder);
|
174
|
|
173
|
|
175
|
}else{
|
174
|
}else{
|
176
|
// 远程创建
|
175
|
// 远程创建
|
177
|
- $ret = $mail->client->folderCreate($origin_folder);
|
176
|
+ $ret = $imap->folder($origin_folder)->create();
|
178
|
}
|
177
|
}
|
179
|
|
178
|
|
180
|
- if($ret[0] === false){
|
179
|
+ if(!$ret){
|
181
|
app()->e($ret[1]);
|
180
|
app()->e($ret[1]);
|
182
|
}
|
181
|
}
|
183
|
|
182
|
|
|
@@ -256,19 +255,18 @@ class Folder extends Base { |
|
@@ -256,19 +255,18 @@ class Folder extends Base { |
256
|
app()->e('folder_delete_exist_mail');
|
255
|
app()->e('folder_delete_exist_mail');
|
257
|
}
|
256
|
}
|
258
|
|
257
|
|
259
|
- // 远程创建
|
|
|
260
|
- $mail = new Mail(
|
|
|
261
|
- $email['email'],
|
|
|
262
|
- base64_decode($email['password']),
|
|
|
263
|
- $email['imap']
|
|
|
264
|
- );
|
258
|
+ $email['password'] = base64_decode($email['password']);
|
|
|
259
|
+ $email['host'] = $email['imap'];
|
|
|
260
|
+ $imap = ImapPool::get(new ImapConfig($email));
|
265
|
|
261
|
|
266
|
- if($mail->login()!=1){
|
262
|
+ if($imap->login()->isOk()){
|
267
|
app()->e('login_error_imap');
|
263
|
app()->e('login_error_imap');
|
268
|
}
|
264
|
}
|
269
|
|
265
|
|
270
|
- // 远程创建
|
|
|
271
|
- $ret = $mail->client->folderDelete($folder['origin_folder']);
|
266
|
+ $f = $imap->folder($folder['origin_folder']);
|
|
|
267
|
+ if(!$f->delete()){
|
|
|
268
|
+ app()->e($f->getMessage());
|
|
|
269
|
+ }
|
272
|
|
270
|
|
273
|
$row = db()->delete(folderSql::$table,[
|
271
|
$row = db()->delete(folderSql::$table,[
|
274
|
'id' => $folder['id']
|
272
|
'id' => $folder['id']
|