Brett
Brett

Reputation: 20049

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 were 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!

Upvotes: 1

Views: 4752

Answers (3)

Ben Gribaudo
Ben Gribaudo

Reputation: 5147

Sounds like you have two tasks before you:

  1. 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.

  2. 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

Upvotes: 2

MANCHUCK
MANCHUCK

Reputation: 2472

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

Upvotes: 2

netcoder
netcoder

Reputation: 67695

As weird as it may sound, check out the imap extension of PHP. It supports POP3 and is fairly easy to use.

Upvotes: 1

Related Questions