|
|
Accessing a POP server with PHP
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
I need a way to access a POP server from a PHP script. But there's a catch.
So PHP has it's own IMAP functions (which include POP). But you have to compile them in with c-client. This won't work for me because I'm running OS X Server. Software updates will repeatedly break my scripts. Anything that needs a custom compiled PHP, won't work. (this server lives 2000 miles away in a data center. maybe my next server will be a simple OS X install, with the good stuff installed with MacPorts. But this server's setup isn't going to change).
Then there's the pear IMAP class for PHP. But again this won't work. This is going to be a high volume script, so I need to stick with POP. The pear class only works with IMAP.
So I'm looking for a third solution.
The basic job I'm looking to accomplish is this: I want to make a script that periodically connects to a PHP server, downloads each email on the server one at a time, parses each email and adds the relevant data to an SQL table.
Ideally, I'd also like control over multi-part messages, so I could "get" just the text portion of multi-part messages, without having to dig through the email contents myself.
So what I'm really looking for, is the POP version of CURL. A simple application I can access within my script, and get the data I want automatically returned to me. In an ideally world, I'd like this command line pop mail client to be a single self contained binary file, that could follow my site from server to server. But really, anything will work as long as it's not something that will get overwritten or broken when I run OS X software updates.
So what do you think?
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status:
Offline
|
|
Originally Posted by l008com
So what I'm really looking for, is the POP version of CURL.
Have you looked at FetchMail?
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Yeah, that doesn't seem to do what I'm looking for.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
Originally Posted by l008com
Yeah, that doesn't seem to do what I'm looking for.
Why not? It could be used within a cronjob.
Why not setup a mail gateway instead of involving POP? I don't understand why you need POP. Just have the mail sent to your server, and include an entry in your /etc/aliases to pipe the mail to your script that does all the parsing and filing.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
i.e., in your /etc/aliases:
aliasusername: "|/path/to/your/script"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|