Jump to content

procmail


jskywalker

Recommended Posts

i'm trying to filter some messages using procmail

 

when a message contains: 'Out: 401', i want to move it to a folder named 401

when a message contains: 'Out: 403', i want to move it to a folder named 403

etc..

 

Now i can make lines for every code possible (401, 403, ....., 450, 454)

But instead i'd like to maken 1 rule for 4xx and have the foldername based on the found code...

 

To achieve this, i tried to define a variable which should get the found errorcode

 

VAR=`formail -I "" | expand | sed -e 's/.*\(Out: \)\(4..\).*/\2/' -e '/^4/!d' | head -1`

 

:0 B

* ^Subject:.*errors

.folderwitherrors.${VAR}/

 

 

My question is, can above be done in a simpler way ? (and, if YES, how to do it.....)

Link to comment
https://forums.phpfreaks.com/topic/214976-procmail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.