View Single Post
  #2 (permalink)  
Old 08-07-2007, 09:24 AM
speed speed is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 863
speed RepRank 1
Default Re: How a message sent through email can be inserted in database on serverside?

Quote:
This is some kind of SERVER side email processing?
Yes
Quote:
How the server read from the email?
The 2 options I'd use is:

1. Collect all emails into a single mailbox and then periodically run a cron job to connect to the mailbox and download each email. You could use PHP IMAP functions to do this http://uk2.php.net/imap

As each email is downloaded the script/application would use the subject line to associate the email with the conversation.

2. Pipe the email arriving at a predetermined address to a script or application which again uses the subject to associate the email with the conversation. If you're running Unix of some flavour then the message is normally passed in on the standard input stream. The following link gives some info on this with PHP http://www.evolt.org/article/Incomin...914/index.html

Option 2 will give a more immediate update as it's invoked as soon as the email arrives while option 1 will only run at a given frequency.

In both cases you need to handle spam, corrupted messages and attachments, to mention a few things.

Both options could just store the message body in the database with a time stamp.
__________________
US & UK Web Hosting with hourly backups | Hosting Affiliate Scheme | Web Directory 2 for 1 Offer
Reply With Quote