Dovecot/Sieve shortcuts?

Adam Shostack adam at shostack.org
Tue May 9 20:53:23 EEST 2017


On Tue, May 09, 2017 at 12:41:10PM -0500, Larry Rosenman wrote:

|     |     >^TO_ did?  that was a macro which expanded to
|     |     >(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope
|     |     >|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)
|     |     >
|     |     >so you could write
|     |     >* ^TO_dovecot
|     |     >dovecot
|     |     >
|     |     >and grab messages to the list.  In sieve, I find myseld writing
|     |     >["To","cc"] and wonder if there's a better way.
|     |     You could use the X-BeenThere or List-Id headers to match mailing list traffic
|     |     
|     |     -- 
|     |     Christian Kivalo
|     |     >
|     |     >Adam
|     | 
|     | I’ve been using:
|     | 
|     | if header :contains ["List-Id","Mailing-List",
|     |         "Sender","X-List-Name","List-Post"]
|     |          ["<mailto:php-general at lists.php.net>"]
|     | {
|     |        fileinto "lists/php/general";
|     |        stop;
|     | }
|     | 
|     | For all my mailing list traffic.  That seems(!) to catch most of them.
|     
|     Thanks!  Is there anything shorter, or a macro capability?  I ask
|     because I manually maintain the file, and really this
|     
|     if address :is :localpart ["to", "cc"] "csprs" {fileinto :create "csprs"; stop;}
|     
|     is easier for me to read and edit than that.
|     
|     
|     Adam
|     
| I haven’t found one.  You might(!) be able to use a script or something to generate it. 
| 
| I just keep repeating the block of code. 
| 
| Yes, it can be on one line, but I like readability ( 

mmmm,  sed
's/PROC_TO/(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope>|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)/g'
readable > .dovecot.sieve && sievec .dovecot.sieve

:)




More information about the dovecot mailing list