by Devin Yang

建立于: 4年前 ( 更新: 4年前 )

收信的信箱爆了,所有的信都不想要,用PHP清空收件夹。
以下是我抄来的范例进程,做了小调整。
<?php
$imap_server="{www.hibox.hinet.net:993/imap/ssl}INBOX";

$mbox = imap_open($imap_server, "信箱帐号", "密码")
    or die("Can't connect: " . imap_last_error());

$check = imap_mailboxmsginfo($mbox);
echo "Messages before delete: " . $check->Nmsgs . "<br />\n";

//标记删除
imap_delete($mbox, "1:$check->Nmsgs");

$check = imap_mailboxmsginfo($mbox);
echo "Messages after  delete: " . $check->Nmsgs . "<br />\n";

imap_expunge($mbox);

$check = imap_mailboxmsginfo($mbox);
echo "Messages after expunge: " . $check->Nmsgs . "<br />\n";

imap_close($mbox);
运行后就被清的一干二净:p

不过PHP,PHP没有imap的扩展,我套过docker轻松扩展有imap的php。
我使用的是D-Laravel的Dockerfile,补上相关的包,再重build dockerfile。
一、添加包:
libc-client-dev libkrb5-dev \
二、添加config 
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
三、补上imap。
RUN docker-php-ext-install -j$(nproc) pdo_mysql mysqli ldap pgsql pdo_pgsql gettext sockets imap ctype xml zip pcntl bcmath intl gd \
以下附下git版控显示的差异。



 

Tags: php

Devin Yang

文章内容无法一一说明,如果您有什么不了解处,欢印提问哦:)

No Comment

Post your comment

需要登入才可留言!

类似文章


php,linux

WebShell功能介绍及注意事项

突然想来介绍什么是WebShell就上网找了一个,他的功能已相当好了, 不过我还想要一些功能,於是就用了三个晚上的时间,替他进行了一些小小的优化。 如果,您还没听过WebShell,快来看看这个影片吧。 如果您喜爱我的优化版本,请给我个赞哦,谢谢啦。

php

Apache移除了Authorization Header问题

Apache移除了Authorization Header,在$_SERVER中看不到解法。

docker,phpenv

用光了Docker IPv4 address pool问题解法

可能在旧版的docker环境,使用Docker compose启动容器时,会碰过下方的错误: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network这其实这是default-address-pools用光的症状,有些环境,docker-compose默认会使用Class B的私有网络。172段的私有IP是有范围的,从172.16.0.0到172.31.255.255。也就是说,当我们起动一个docker-compose的Project,就会吃掉一个Class B的私有段,非常豪迈,