使用php从POP3服务器中获取邮件 [英] Fetching mail from a POP3 server using php

查看:461
本文介绍了使用php从POP3服务器中获取邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从POP3中获取邮件(我正在使用POP3邮件服务器,并且正在尝试获取邮件内容并将其存储到我的项目的数据库表中.),但是找不到任何PHP脚本用于那都只用于IMAP.

I am trying to fetch a mail from POP3 (I am using POP3 mail server and I am trying to fetch the mail content and store into a database table for my project.), but I can't find any PHP script for that, all are only for IMAP.

您知道如何从POP3服务器获取邮件吗?

Do you know how to fetch mail from a POP3 server?

谢谢.

推荐答案

令人惊讶的是, PHP的imap库也可用于处理POP3邮箱.当然,大多数高级IMAP功能都不起作用(例如,文件夹或提取邮件部分),但是基本的POP3功能已实现.

Somewhat surprisingly, PHP's imap library can be also used for working with POP3 mailboxes. Most of the advanced IMAP features won't work, of course (e.g. folders or fetching message parts), but the basic POP3 functionality is implemented.

主要区别在于您要传递给 imap_open的选项字符串-引用该页面:

The main difference is the option string that you're passing to imap_open - to quote that page:

// To connect to a POP3 server on port 110 on the local server, use:
$mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password");

除此之外,这是一帆风顺的-基本的POP3访问权限只需要imap_open,imap_num_msg,imap_body,imap_delete和imap_close.

Other than that, it's fair sailing - you won't need more than imap_open, imap_num_msg, imap_body, imap_delete and imap_close for basic POP3 access.

这篇关于使用php从POP3服务器中获取邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆