At 00:51 2002-03-23 -0500, Shannon D. Denniston did say:
Is there a way to strip out lines of the body
content in an e-mail message and then have
parts of each line entered into a database as
variables?
If you need to stuff it into a database, you're going to need an external
program capable of manupulating the DB. You should consider just passing
the message into a perl script.
Otherwise,
:0
* ^Subject: Shannon, Someone has just visited your site!
{
First Name: Johnny
:0
* B ?? ^First Name:[ ]*\/.*
{
FNAME=$MATCH
}
Last Name: Prospect
:0
* B ?? ^Last Name:[ ]*\/.*
{
LNAME=$MATCH
}
Phone: 555-555-5555
(you get the idea by now, I trust)
:0ci
{
# call some script and pass it all these variables
| somescript.pl "$FNAME" "$LNAME" "$PHONE" ....
}
(of course, I'd just have the perl script parse the message directly)
}
[snip, geez, the rest of that message looks like a SPAM you've just sent to
the procmail list - if the fields above are all you needed to extract from,
there was no need to include the full text of the message]
I need to have the 7 variables above entered into a mySQL
database. When the variables are added, I need to have the
Which is going to require an external program capable of talking to the
mySQL db. At that point, you're better off having procmail simply identify
these messages and pipe them to a perl script or something. That script of
course is totally outside the realm of this list.
>>> Template E-Mail #2 (New Member Letter) <<<<
[snip, same routine, different format, excepting the two-fields on one line
bit, which would be easier to deal with in perl]
Does anyone know how to do this?
Yes, but the mySQL connection isn't going to happen from within procmail,
unless you want to get really obtuse and have procmail construct a command
file on the fly and pipe that into the mysql console.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail