Thanks for the input Jim...I'll give the perl script a go tonight.  AE

-----Original Message-----
From: Jim Bowen [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 8:51 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Automated entry of e-mails into database?


Yeah..... the mail is piped as the standard input to the program. $1 refers
to the first parameter

Try something like


#!/usr/bin/perl
open OUTPUT_FILE, ">> /tmp/msg";
while ($line_of_text = <>) {
        print OUTPUT_FILE $line_of_text;
}
close OUTPUT_FILE;

which will take the email line by line, and print it out to the output file
You could easily do the conditional stuff in the while loop, and perl
supports mysql, too.

Good luck tho - it is no small feat to write helpdesk software :)


Jim

        

-----Original Message-----
From: Adam Ellis [mailto:[EMAIL PROTECTED]] 
Sent: 29 July 2002 13:47
To: '[EMAIL PROTECTED]'
Subject: Automated entry of e-mails into database?

I am trying to come up with a system that will allow me to take incoming
e-mail messages and enter key fields into a database.  So, for example, all
e-mails to [EMAIL PROTECTED] will be pulled apart and fields like
Problem Description, Date, Priority, etc. will be pulled out of the message
body and inserted into a mySQL database.  First off, does anybody know if
there is any software out there that does this already (I did not see any on
Sourceforge or Freshmeat)?  If not, perhaps you can help me to make my first
baby steps here.  I've got the messages downloading into Sendmail using
Fetchmail and have come up with a Procmail recipe that pushes any messages
with a certain subject line into a program for processing.  If I set that
program to 'cat >> /tmp/msg' I see the message dumped into the /tmp/msg
file.  If I set that program to '/home/ae/MyBashScript' where MyBashScript
is:

#!/bin/bash
echo $1 >> /tmp/msg

...I do not get the same result.  Am I missing something here?  

Thanks in advance,
AE



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

This E-Mail is sent in confidence for the addressee only.  Unauthorised
recipients must preserve this confidentiality and should please advise the
sender immediately by telephone (+44 (0)870 241 6492) and return the
original E-Mail to the sender without taking a copy. Cyprotex has taken all
reasonable precautions to ensure that no viruses are transmitted from
Cyprotex to any third party.  Cyprotex accepts no responsibility for any
loss or damage resulting directly or indirectly from the use of this E-Mail
or the contents.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to