Mail to MySQL database

I want to send data to an email address and store it in a MySQL database (PHP). What is the easiest way to do this? (no form message, no curl, etc., just email)

+6
php mysql email
source share
6 answers

If your server does not have imap, but you have an external system that has cron, you can write a page that verifies the email account and loads the data into MySQL, and then configure the script on a machine that has cron to wget on mysql page once every X minutes, where X is how often you want to load data.

Alternatively, if you know that emails will load quickly, you can set up a small table of fields in your database with a time stamp. Each time your PHP script is executed, it checks the timestamp, and if it is more than 5 minutes, it causes the email to load the script before loading the web page.

+4
source share

There are several ways.

  • use the alias postfix script, basically the postfix receives your mail and then runs it through the script of your choice. The content of the mail appears in STDIN - then you can do as you wish with the content of the mail.

  • Use a custom mail server, such as apache james, which is designed to handle mail, and β€œdo something with it”

{The good one I found recently was in Google Labs - http://freshmeat.net/projects/subethasmtp } - it looked very good.

PLS remember that writing is not a guaranteed protocol, if you are trying to exchange application-to-application messaging, then there are probably better ways!

Hope this helps., Ace

+5
source share

If you can access your email using POP, have a process by checking the email using the POP function and sending everything to your database

Also you can use php IMAP support

+4
source share

Assuming that you already know how to save data in mysql, you will need access to the mail server, your own, web hosting, or you can use free one such as Gmail or Hotmail.

You can then use the PHP IMAP functions (which can also access POP) to access your mail. Articles that may help you: PHP imap info and tutorial on creating PHP webmail

+3
source share

There is a step-by-step guide to slicehost, which uses a unix-based machine, installs a postfix on it, configures it to use MySQL, and configures it to accept virtual users and send / receive email from multiple domains.

The setup is clean, fast and reliable. Life is good, huh ??

http://articles.slicehost.com/email

+1
source share

Maybe you should look at www.dbmail.org

+1
source share

All Articles