切换导航条
此项目
正在载入...
登录
周海龙
/
mail-serve
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
邓超
7 months ago
提交
3af2fe6152bcc3daff15a2a8dd5155f53c786804
1 个父辈
519874a3
m
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
60 行增加
和
0 行删除
controller/Test.php
lib/Imap/ImapConfig.php
controller/Test.php
查看文件 @
3af2fe6
...
...
@@ -16,10 +16,62 @@ class Test {
public
function
home
(){
if
(
app
()
->
request
(
'sign'
)
!=
's1'
){
http_response_code
(
404
);
app
()
->
e
(
404
,
404
);
}
$email
=
db
()
->
first
(
emailSql
::
first
(
app
()
->
request
(
'mid'
)));
$config
=
(
new
\Lib\Imap\ImapConfig
())
->
setEmail
(
$email
[
'email'
])
->
setPassword
(
base64_decode
(
$email
[
'password'
]))
->
setHost
(
$email
[
'imap'
]);
$imap
=
\Lib\Imap\ImapPool
::
get
(
$config
);
//$imap->debug();
$login
=
$imap
->
login
();
if
(
$login
->
isOk
())
{
$msgno
=
(
int
)
app
()
->
request
(
'msgno'
);
// foreach ($imap->getFolders()->all() as $a){
// echo $a->folder;
// echo '=>';
// echo $a->getParseFolder();
// echo '|';
// };
$folder
=
$imap
->
folder
(
'INBOX'
);
// echo '总共有:';
// echo $folder->getTotal();
// echo "<br>";
// echo "<br>";
// echo '<a href="?msgno='.($msgno+1).'">下一个</a>';
// echo "<br>";
// echo "<hr>";
$msg
=
$folder
->
msg
()
->
msgno
(
$msgno
)
->
get
()
->
first
();
if
(
$msg
)
{
// echo $msg->header->getSubject();
// echo '<br>-------------------------------------------------<br>';
if
(
$msg
->
body
->
getHtml
()){
echo
$msg
->
body
->
getHtml
();
}
else
{
echo
$msg
->
body
->
getText
();
}
// echo $msg->body->getAttachment();
// foreach ($msg->body->getAttachment() as $attachment){
// header("Content-Type:".$attachment->getFileType());
// echo $attachment->getContent();
// break;
// }
}
}
else
{
echo
$login
->
getMessage
();
}
}
}
...
...
lib/Imap/ImapConfig.php
查看文件 @
3af2fe6
...
...
@@ -24,6 +24,14 @@ class ImapConfig {
public
function
setHost
(
string
$host
)
:
static
{
$this
->
host
=
$host
;
// 是否带协议
if
(
!
str_contains
(
$this
->
host
,
'//'
)){
$this
->
host
=
'ssl://'
.
$this
->
host
;
}
// 是否带端口
if
(
substr_count
(
$this
->
host
,
':'
)
==
1
){
$this
->
host
=
$this
->
host
.
':993'
;
}
return
$this
;
}
...
...
请
注册
或
登录
后发表评论