parsing email into mySQL database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tswitz00
Forum Newbie
Posts: 1
Joined: Thu Jan 27, 2005 9:20 am

parsing email into mySQL database

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post 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/
Post Reply