Dovecot/Sieve shortcuts?

Darac Marjal mailinglist at darac.org.uk
Wed May 10 12:50:23 EEST 2017


On Tue, May 09, 2017 at 11:27:22AM -0500, Larry Rosenman wrote:
>On 5/9/17, 11:25 AM, "dovecot on behalf of Christian Kivalo" <dovecot-bounces at dovecot.org on behalf of ml+dovecot at valo.at> wrote:
>
>
>
>    Am 9. Mai 2017 17:47:13 MESZ schrieb Adam Shostack <adam at shostack.org>:
>    >Hi,
>    >
>    >Is there a clean way to match on an email address the way procmail
>    >^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.

I can't remember where I got the original algorithm (and, in particular,
the ordering) from, but I've been using the attached sieve script for a
while with numerous mailinglists. It uses the 'regex' module to parse
the mailing-list name from the headers (with various attempts to handle
most of the major mailing-list applications). The listname is
lower-cased (for consistency) and the message is filed into that folder (creating the folder if necessary). This means that, when I sign up for a new mailing-list, messages just start appearing in their own folder.

-- 
For more information, please reread.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mailinglist.sieve
Type: application/sieve
Size: 2842 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20170510/ce6c5f13/attachment.sieve>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 906 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20170510/ce6c5f13/attachment.sig>


More information about the dovecot mailing list