bigmike7801
bigmike7801

Reputation: 3970

How to make an email update the database?

I'm creating a site in PHP and MySQL that when an image is emailed to us at [email protected] from someone's phone, I want the image to be automatically posted to their account page that is tied to the email address that they registered with us.

Also, I would like the subject of the email to determine what category the email falls under. So lets say the email had the subject of 3. Then it would give it the category ID of 3.

So lets say we have a users table with

user_id
email_address
name

and an image table with the following fields

image_id
category_id
user_id
image_name

The category table will be category_id category_name

Is there something I need to be doing with our mail server? Also should I be storing the image in the database or as a file?

This site will not get a lot of traffic and will only be used for one weekend. I'm guessing no more than 5000 images but I could be wrong.

Upvotes: 3

Views: 512

Answers (1)

Michael Mior
Michael Mior

Reputation: 28752

Look at procmail for passing emails into scripts. Images should definitely be stored as files. You'll have to parse the email you receive and base64_decode the appropriate chunk to get the image data.

Upvotes: 1

Related Questions