开发者

How to display everything that is sent to an email address on a website?

I would like to display all the subjects of email received on a website. Is there an open source "pop to php" script? Or a service I can use di开发者_开发问答rectly?

Any help is appreciated! thanks!


I would use the built-in PHP IMAP functions. Here's a sample for you:

$mbox = imap_open ("{yourserver.com:110/pop3/novalidate-cert}INBOX", "my@email.com", "myPassword");
if (!$mbox) {
    return false;
}
$m_search = imap_search($mbox, 'UNDELETED');
        $messages = array();
        if($m_search < 1) {
            return 'No New Messages';
        } else {
            foreach ($m_search as $item) {
                $headers = imap_headerinfo($mbox, $item);
                $struct = imap_fetchstructure($mbox, $item);
                $body = imap_body($mbox, $item);

                $headers->subtype = $struct->subtype;
                $headers->body = $body;

                $messages[] = $headers;

            }
        }

        imap_close($mbox);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜