切换导航条
此项目
正在载入...
登录
周海龙
/
mail-serve
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
邓超
6 months ago
提交
482abe99b7fa6ffaab5a1cc562ba818d0493221d
1 个父辈
3e831449
x
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
23 行增加
和
13 行删除
lang/zh.php
service/SyncMail.php
lang/zh.php
查看文件 @
482abe9
...
...
@@ -16,8 +16,8 @@ return [
'server_error'
=>
'服务器异常'
,
'email_server_error'
=>
'请检查imap,smtp服务是否开启/密码是否正确'
,
'email_smtp_server_error'
=>
'SMTP:连接邮件服务器失败,请检查邮件服务器地址是否正确'
,
'email_server_error'
=>
'请检查imap/smtp的服务地址是否正确'
,
'email_smtp_server_error'
=>
'SMTP:连接邮件服务器失败'
,
'login_error'
=>
'登录失败'
,
'login_error_imap'
=>
'登录失败,请检查密码是否正确或者是否开启imap/smtp服务'
,
...
...
service/SyncMail.php
查看文件 @
482abe9
...
...
@@ -44,7 +44,7 @@ class SyncMail {
* @param int|string|array $email
* @throws \Exception
*/
public
function
__construct
(
int
|
string
|
array
$email
)
public
function
__construct
(
int
|
string
|
array
$email
,
\Lib\Imap\Imap
|
null
$imap
=
null
)
{
$this
->
db
=
db
();
...
...
@@ -56,16 +56,20 @@ class SyncMail {
}
$this
->
email
=
$email
;
// 实例一个imap类
$this
->
imap
=
ImapPool
::
get
(
(
new
ImapConfig
())
->
setHost
(
$email
[
'imap'
])
->
setEmail
(
$email
[
'email'
])
->
setPassword
(
base64_decode
(
$email
[
'password'
]))
if
(
$imap
instanceof
\Lib\Imap\Imap
){
$this
->
imap
=
$imap
;
}
else
{
$this
->
imap
=
ImapPool
::
get
(
(
new
ImapConfig
())
->
setHost
(
$email
[
'imap'
])
->
setEmail
(
$email
[
'email'
])
->
setPassword
(
base64_decode
(
$email
[
'password'
]))
// ->debug()
);
);
$this
->
login
();
$this
->
login
();
}
}
public
function
stop
(){
...
...
@@ -146,12 +150,13 @@ class SyncMail {
}
/**
* 同步
* @param bool $syncMail
* @return bool|void
* @throws \Exception
* @author:dc
* @time 2024/
9/26 10:46
* @time 2024/
10/18 17:53
*/
public
function
sync
(){
public
function
sync
(
$syncMail
=
true
){
$this
->
isStop
=
false
;
/*********************************** 同步文件夹 ***************************************/
// 获取文件夹
...
...
@@ -161,6 +166,9 @@ class SyncMail {
// 删除以前的
$this
->
db
->
delete
(
folderSql
::
$table
,[
'uuid.notin'
=>
$uuids
,
'email_id'
=>
$this
->
emailId
()]);
}
if
(
!
$syncMail
)
return
true
;
_echo
(
$this
->
emailId
()
.
' ===> 文件夹同步成功'
);
if
(
$this
->
isStop
)
return
;
...
...
@@ -313,6 +321,8 @@ class SyncMail {
'is_file'
=>
$item
->
isAttachment
()
?
1
:
0
//是否附件
];
$data
[
'from'
]
=
mb_substr
(
$data
[
'from'
],
0
,
120
);
// 不知道为什么 有些邮件标题有下划线,但是发件那边并没有添加下划线
$data
[
'subject'
]
=
str_replace
(
'_'
,
' '
,
$data
[
'subject'
]);
...
...
请
注册
或
登录
后发表评论