procmail
[Top] [All Lists]

SOLVED: Trying to get some data from the body added to the subject

2006-04-24 06:54:50
Francesco Peeters schreef:
This is my first attempt at something as complex as this...

Can you please have a look at below recipe draft?

The idea is to take part of the body and put it in the subject line 
before delivery...

Sample message:

Subject: Blablablabl

Symbol: ABC/DEF
Price:  1234.56
Time:   04/23/2006 13:00:00
Signal Name:  XYZ 1A

Intended result:

Subject: Blablablabla Symbol: ABC/DEF Signal Name: XYZ 1A

I have been researching and came to this:

--------- Begin Recipe -----------
:0
* B  ?? ^Symbol: *\/.*
SYMBOL=$MATCH

:0
* B  ?? ^Signal Name:  *\/.*
NAME=$MATCH

:0f
* ^Subject: \/.*
| formail -bfi "Subject: $MATCH Symbol: $SYMBOL Signal Name: $NAME"
--------- End Recipe -----------

And after that the remainder of the recipes that determine where to put 
it...

Would this work and create the effect as described above?

(This is the first time I try something as complex as this, so I am a 
bit wary of putting it in before someone has had a chance to check it
for obvious errors...)

TIA & BRgds


I went ahead and created a temporary mail account to test it on, and I 
ended up with a working recipe:

--------- Begin Recipe -----------
:0
* B  ?? ^Symbol: *\/.*
{ PAIR=$MATCH }

:0
* B  ?? ^Signal Name:  *\/.*
{ NAME=$MATCH }

:0f
* ^Subject: \/.*
|formail -bfi "Subject: $MATCH Symbol: $PAIR Signal Name: $NAME"
--------- End Recipe -----------

Just sending this out so the archives are complete  ;-)

-- 
Francesco Peeters

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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