Page 1 of 1

parsing email into mySQL database

Posted: Thu Jan 27, 2005 9:23 am
by tswitz00
This would be huge if someone could help me out with this.

What I am wanting to do is take an email being sent to our server open it up and parse out infomration from the body text that looks similar to this:

ID: 60789
Name: Bob

Then i want to be able to grab the 60789 and insert into our sql database under the lead_id column.
I want to be able to automate this process. maybe with a cron job.


Thanks

Posted: Thu Jan 27, 2005 9:27 am
by feyd
the imap extension should be able to get your email, regular expressions would be used to find and extract that ID information from the email.

Depending on the server config and things, you can create an email filter that would pipe the email through a php script whenever a message is received.

Posted: Thu Jan 27, 2005 1:04 pm
by AGISB
This link might be actually the thing you look for. Just change the file part with the database and use some loging on the text.

http://www.evolt.org/article/Incoming_M ... /18/27914/