Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Stripping content of an email



2:08 pm on May 4, 2011 (gmt 0)

10+ Year Member

Hi there,

Say I setup an email address to receive specific emails.

What would I have to do to get php to read the contents of the email, strip certain parts in a certain way and return them to a function to insert each part appropriately into a db.

I don't really even know where to start on this one but I reckon I will need a cron job and curl possibly.

Anyone have any experience with this?



4:30 pm on May 4, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Mmm, since you're talking about a mail function you'd have to parse out mailbox queues, not something I've done a lot of (and a long time ago.) Basically whatever system you use (let's say, sendmail) you'd have to figure out where the mail is stored and build an app to parse out the mailbox. Lots of command line stuff and permissions issues to deal with, as I recall.


3:54 pm on May 7, 2011 (gmt 0)

WebmasterWorld Senior Member themadscientist is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

What rocknbil said, with a twist:

If you use cPanel you can select the Forward > Pipe to Program option and send the incoming mail to a PHP executable.

If you don't you will need to adjust you mail software like rockinbil said, but again, you can run them through a PHP executable. I don't know what software you use, but with cPanel it's simple to get it to the program and with Postfix it's a bit more complicated but nothing too super, extra ugly. (Of course how 'ugly' depends on your definition of 'ugly to code' ... lol)

Featured Threads

Hot Threads This Week

Hot Threads This Month