procmail
[Top] [All Lists]

Re: How do you strip out data from the body of an e-mail?

2002-03-22 23:37:02
Sean,

Thanks for your help. Would you be interested
in working with my PHP programmer on this?
What would you charge me to do the part leading
into the script? (my PHP programmer can take
over where you leave off I assume)

Sincerely,
Shannon D. Denniston
Shannon(_at_)DennistonInc(_dot_)com



----- Original Message ----- 
From: Professional Software Engineering 
<PSE-L(_at_)mail(_dot_)professional(_dot_)org>
To: <procmail-users(_at_)procmail(_dot_)org>
Sent: Saturday, March 23, 2002 1:12 AM
Subject: Re: How do you strip out data from the body of an e-mail?


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

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>