How do you make PHP read POP emails?
I'm looking for a very simple PHP email reader (I use "reader" loosely - I really only want to be able to perform database operations on each email). I'd prefer it to use POP, but I could settle with IMAP if I have to. I know PHP suppo开发者_运维知识库rts these, but I'm having trouble finding codes with the bare minimum that I'm looking for. All I would like to be able to do is to extract the "to" address, the "from" address, the subject, the body, and the date/time sent. I do not need anything else. Any ideas?
POP is usually only used when you want to download-and-delete messages off the server. If you want to keep the messages on the server, you may as well just use IMAP.
Either way, you can use the IMAP extension for PHP. Technically, it supports both IMAP and POP (as well as NNTP), but not all capabilities/functions are available for POP.
And what you want to do is pretty simple. Just look at the PHP documentation for imap_headerinfo()
and imap_body()
. There's no need to find a script or "codes" that do exactly what you want. It would be quicker to write the code yourself.
精彩评论