如何只找到“新的”使用 PHP 的 IMAP 函数处理 POP3 邮箱时会收到消息吗?
我正在使用 PHP 的 IMAP 函数从 POP3 邮箱和 POP3 邮箱检索消息。想知道有什么办法可以区分新消息和旧消息吗?
不幸的是,我不能只删除检索到的邮件,因为它们需要保留在邮件服务器上,所以我现在想知道每次后续连接时,我怎样才能检索新邮件或能够区分新邮件从我之前已经检索到的旧的?
我知道每条消息都附有一个 UID &我可以使用这个..但是我读到如果消息被删除,这可能会改变;因为消息可能会从服务器中删除。
I'm using PHP's IMAP functions to retrieve messages from a POP3 mailbox & was wondering is there any way to tell the new messages apart from the old ones?
Unfortunately I cannot just delete the ones that are retrieved as they need to stay on the mail server, so I'm now wondering that each subsequent time I connect, how can I just retrieve the new ones OR be able to tell the new ones apart from the old ones I have already retrieved previously?
I know that each message has a UID attached to it & I could use this.. however I've read that this can change if the messages are deleted; as the messages may be deleted from the server down the track.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
还好找到了这个..
虽然我很确定我之前读过并非所有客户端都会返回 message_id...有人知道这是否正确?
Well found this..
Although I'm pretty sure I read before that not all clients will returns the message_id... anyone know if this is correct?
这对我有用:
参考:https://www.electrictoolbox.com/php- imap-未读消息/
This worked for me:
Reference: https://www.electrictoolbox.com/php-imap-unread-messages/