Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing email into mysql database

Status
Not open for further replies.

tswitz00

IS-IT--Management
Jan 26, 2005
67
US
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
 
Insufficient data for a meaningful answer.


There are too many possible solutions at this point to recommend one.

I guess the first question is, where is PHP relative to the mailbox which is going to be the receiver for these emails? If the mailbox resides on the machine which has PHP installed, depending on your MTA you may be able to directly invoke your PHP script when the mail is delivered rather than on a cron job. If the mailbox is not on the same machine as the one running PHP, then we're talking about a cron job and some network communications of some sort.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
The php and the mailbox would be on the same server. All the mail would be going to one user account. All containing the same subject with the same formatting of the body just diffrent information.
 
Its on a unix machine. I am not sure as to what mail server it uses.
 
The easiest way to parse these emails will be to have your MTA invoke the script whenever an email arrives. Many MTAs on unix-like OSes have this capability.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top