parsing email message...

jechilt

Verified User
Joined
Jun 21, 2004
Messages
225
Does anyone know how to parse and email message to look for something like "====== Please reply above this line ======" so php can read in a message to that line and then submit that data to the helpdesk?
I am having a hard time finding a reference on how to do this and know there are a lot of really savvy admins in the forum.

thanks for any help!
 
Are you talking about parsing the email within an email spool file, or after it's been removed from the file and is in it's own file?

You can parse an email out of a spool file (the email folder file) using mailgrep, here.

Jeff
 
Hi Jeff...
It is a very good question you pose and I am not sure how to answer it.
The email, which is sent by a technician responding to a trouble ticket, is put into the trouble ticket database. Only problem is the whole message is getting put in the database. What I need to do is figure out if it is possible to have a break line or something to key off of so the only part that gets put into the database is the technician answer, not the whole email.
Probably easier to switch to some software like cerberus but don't think I could swing it at the moment and the trouble ticket system we have currently works...
 
The program that's putting the email into the database has to do the grepping.

I don't know anything about what you're using or how it's working.

I hope you do :) .

Jeff
 
Not sure which language you are using php or perl, but here are two examples that will do just that, assuming the whole email message is in $buffer.
Code:
[B]Perl[/B]
$buffer =~ s/====== Please reply above this line ======.*//sm;
Code:
[B]PHP[/B]
$pattern='/====== Please reply above this line ======.*/sm';
$buffer=preg_replace($pattern,'',$buffer);
 
Back
Top