POP3 email to MySQL database? What options do I have?
Ok..... basically what I'm trying to do is setup something that will handle all incoming mail on a certain POP3 email address, pass all the relevant data to a PHP script, which will then parse the data & insert it into a MySQL database.
Now I have been looking around a bit..... checked out procmail, but that just confused the hell outta me (I'm not much of a server guy, just know enough CL stuff to get by), so was wondering if there we开发者_如何学JAVAre any better options available to me or any existing PHP classes that made it a bit easier?
Thanks a lot - any help would be much appreciated!
Sounds like you have two tasks before you:
Write a PHP script that checks the POP3 account, processing any mail it finds.--You could use PHP's IMAP functionality, which supports IMAP, POP3 and NNTP.
Somehow get the above-mentioned script to run when new mail is received.--An easy way to simulate this effect would be to use a cron task to run your script regularly...perhaps every few minutes. Hopefully, your web host supports cron tasks--you may find an option to set them up in your hosting account's control panel or you may need to contact support for assistance.
Hope this helps,
Ben
There are some classes built to help you out as well:
http://www.phpclasses.org/package/2-PHP-Access-to-e-mail-mailboxes-using-the-POP3-protocol.html
As weird as it may sound, check out the imap extension of PHP. It supports POP3 and is fairly easy to use.
精彩评论