Hello Community,
I was wondering if there is a way to send an email to a database?

Example:
So when the user sends an email to my websites email address the email will be broken up in to parts (Subject, From, Body etc...) and added to the database.

FYI: I'm using GoDaddy and a normal website hosting account that is using Linux.

Member Avatar
diafol

You want to store this in an external DB? You want the data to be sent to your php server (and then to MySQL server) triggered by the email arriving in your inbox.

Or do you just need access to the mails (e.g. imap etc as mentioned)? Good post here:

http://harrybailey.com/2009/02/send-or-pipe-an-email-to-a-php-script/

FYI: I'm using GoDaddy and a normal website hosting account that is using Linux.

You may need to set up a subdomain (usu. via cPanel) - but I don't know if your bog standard GD hosting has that. You'll need to check these things.

commented: very useful! +11

I don't know if this will help with what I want to acomplish.
I want a system so people can retrieve information from their profile by sending an email to my website email address then the website will gather what the user wants and emails it back to them.

Member Avatar
diafol

This should certainly be possible - as an extension of the method I outlined above. You simply tag on the 'email data out' code after the SQL query.

Member Avatar
diafol

The only thing I'd say is that data within an email has to be formatted perfectly for it to work (i assume). SO email may not be the most effective method. An email form on your website should force certain formats. However, if you use a webform, this could be sent directly to the script without need for an email at all. The script of course could then send details of the update/request back to the user via email. No need for piping at all for that. The original request could be logged in a DB table and so could details of the 'returned email'.

Well if thats the easiest way then I'll just have to do that.