[Dovecot] Sieve & Adding headers.
Hi all,
I've just migrated my mail system from procmail to managesieve/sieve and I'm having trouble trying to duplicate a could of rules I used to use in my procmail config.
One particular rule would be this: :0 Wfh
- ^Sender: owner-scientific-linux-devel@LISTSERV.FNAL.GOV | (sed -e '/^Subject:/ s/\[SCIENTIFIC-LINUX-DEVEL\] *//g'| sed ':a;N;$!ba;s/Precedence: list/Precedence: list\nList-Post: mailto:scientific-linux-devel@fnal.gov/g') :0 A .Mail\ Lists.SL-Devel/
This in effect adds the header "List-Post: mailto:scientific-linux-devel@fnal.gov" after "Precedence: list". This allows me to use the Reply To List functionality in Thunderbird.
Another rule is: :0 Wfh
- ^X-BeenThere: users@lists.repoforge.org | sed -e '/^Subject:/ s/\[users\] *//g' :0 A .Mail\ Lists.RPMForge/
This removes the [users] tag from the subject of each message to the RPMForge / RepoForge mailing lists.
Is there a way to do this with sieve? Nothing I have seen seems to do this - however I'm only a beginner in this area.
Please CC myself as well as the list. I'm not currently subscribed.
-- Steven Haigh
Email: netwiz@crc.id.au Web: http://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897 Fax: (03) 8338 0299
On 7/25/2012 3:56 AM, Steven Haigh wrote:
Hi all,
I've just migrated my mail system from procmail to managesieve/sieve and I'm having trouble trying to duplicate a could of rules I used to use in my procmail config.
One particular rule would be this: :0 Wfh
- ^Sender: owner-scientific-linux-devel@LISTSERV.FNAL.GOV | (sed -e '/^Subject:/ s/\[SCIENTIFIC-LINUX-DEVEL\] *//g'| sed ':a;N;$!ba;s/Precedence: list/Precedence: list\nList-Post: mailto:scientific-linux-devel@fnal.gov/g') :0 A .Mail\ Lists.SL-Devel/
This in effect adds the header "List-Post: mailto:scientific-linux-devel@fnal.gov" after "Precedence: list". This allows me to use the Reply To List functionality in Thunderbird.
You'll need the editheader extension (meaning a fairly new Pigeonhole v0.3.0+):
require ["fileinto", "editheader", "variables", "regex"];
if address "sender" "owner-scientific-linux-devel@LISTSERV.FNAL.GOV" { if header :regex "subject" "\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)" { deleteheader "Subject"; addheader "Subject" "${1}"; }
addheader "List-Post" "<mailto:scientific-linux-devel@fnal.gov>";
fileinto "Mail List.SL-Devel";
}
Another rule is: :0 Wfh
- ^X-BeenThere: users@lists.repoforge.org | sed -e '/^Subject:/ s/\[users\] *//g' :0 A .Mail\ Lists.RPMForge/
This removes the [users] tag from the subject of each message to the RPMForge / RepoForge mailing lists.
Is there a way to do this with sieve? Nothing I have seen seems to do this - however I'm only a beginner in this area.
Please CC myself as well as the list. I'm not currently subscribed.
require ["fileinto", "editheader", "variables", "regex"];
if header "X-BeenThere" "users@lists.repoforge.org" { if header :regex "subject" "\\[users\\] *(.*)" { deleteheader "Subject"; addheader "Subject" "${1}"; } fileinto "Mail Lists.RPMForge"; }
Don't forget to enable the editheader extension in your configuration using the sieve_extensions setting.
Regards,
Stephan.
Thanks for the reply Stephan!
Out of interest, how can I tell what version is installed? The system is EL6.2 - but dovecot etc is installed via yum.
It currently has: # rpm -qa | grep dovecot dovecot-2.0.9-2.el6_1.1.x86_64 dovecot-pigeonhole-2.0.9-2.el6_1.1.x86_64 dovecot-mysql-2.0.9-2.el6_1.1.x86_64
However these look nothing like the pigeonhole version numbers. I can see a few newer packages here and there, but some guidance would be helpful for upgrading either both dovecot & managesieve etc, or just managesieve.
-- Steven Haigh
Email: netwiz@crc.id.au Web: http://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897 Fax: (03) 8338 0299
On 25/07/2012 5:16 PM, Stephan Bosch wrote:
On 7/25/2012 3:56 AM, Steven Haigh wrote:
Hi all,
I've just migrated my mail system from procmail to managesieve/sieve and I'm having trouble trying to duplicate a could of rules I used to use in my procmail config.
One particular rule would be this: :0 Wfh
- ^Sender: owner-scientific-linux-devel@LISTSERV.FNAL.GOV | (sed -e '/^Subject:/ s/\[SCIENTIFIC-LINUX-DEVEL\] *//g'| sed ':a;N;$!ba;s/Precedence: list/Precedence: list\nList-Post: mailto:scientific-linux-devel@fnal.gov/g') :0 A .Mail\ Lists.SL-Devel/
This in effect adds the header "List-Post: mailto:scientific-linux-devel@fnal.gov" after "Precedence: list". This allows me to use the Reply To List functionality in Thunderbird.
You'll need the editheader extension (meaning a fairly new Pigeonhole v0.3.0+):
require ["fileinto", "editheader", "variables", "regex"];
if address "sender" "owner-scientific-linux-devel@LISTSERV.FNAL.GOV" { if header :regex "subject" "\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)" { deleteheader "Subject"; addheader "Subject" "${1}"; }
addheader "List-Post" "<mailto:scientific-linux-devel@fnal.gov>"; fileinto "Mail List.SL-Devel";
}
Another rule is: :0 Wfh
- ^X-BeenThere: users@lists.repoforge.org | sed -e '/^Subject:/ s/\[users\] *//g' :0 A .Mail\ Lists.RPMForge/
This removes the [users] tag from the subject of each message to the RPMForge / RepoForge mailing lists.
Is there a way to do this with sieve? Nothing I have seen seems to do this - however I'm only a beginner in this area.
Please CC myself as well as the list. I'm not currently subscribed.
require ["fileinto", "editheader", "variables", "regex"];
if header "X-BeenThere" "users@lists.repoforge.org" { if header :regex "subject" "\\[users\\] *(.*)" { deleteheader "Subject"; addheader "Subject" "${1}"; } fileinto "Mail Lists.RPMForge"; }
Don't forget to enable the editheader extension in your configuration using the sieve_extensions setting.
Regards,
Stephan.
Op 7/25/2012 9:57 AM, Steven Haigh schreef:
Thanks for the reply Stephan!
Out of interest, how can I tell what version is installed? The system is EL6.2 - but dovecot etc is installed via yum.
It currently has: # rpm -qa | grep dovecot dovecot-2.0.9-2.el6_1.1.x86_64 dovecot-pigeonhole-2.0.9-2.el6_1.1.x86_64 dovecot-mysql-2.0.9-2.el6_1.1.x86_64
However these look nothing like the pigeonhole version numbers. I can see a few newer packages here and there, but some guidance would be helpful for upgrading either both dovecot & managesieve etc, or just managesieve.
I should have mentioned that right away: Pigeonhole 0.3.x is for Dovecot v2.1
Regards,
Stephan.
On 25/07/2012 7:12 PM, Stephan Bosch wrote:
Op 7/25/2012 9:57 AM, Steven Haigh schreef:
Thanks for the reply Stephan!
Out of interest, how can I tell what version is installed? The system is EL6.2 - but dovecot etc is installed via yum.
It currently has: # rpm -qa | grep dovecot dovecot-2.0.9-2.el6_1.1.x86_64 dovecot-pigeonhole-2.0.9-2.el6_1.1.x86_64 dovecot-mysql-2.0.9-2.el6_1.1.x86_64
However these look nothing like the pigeonhole version numbers. I can see a few newer packages here and there, but some guidance would be helpful for upgrading either both dovecot & managesieve etc, or just managesieve.
I should have mentioned that right away: Pigeonhole 0.3.x is for Dovecot v2.1
Thanks again!
Does anyone on the list happen to know if the atrpms dovecot packages are / have been updated on a regular basis?
They seem to be newer than the EL6 ones, but the last build seems to have been 2.1 beta1.
-- Steven Haigh
Email: netwiz@crc.id.au Web: http://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897 Fax: (03) 8338 0299
On 25/07/2012 7:12 PM, Stephan Bosch wrote:
Op 7/25/2012 9:57 AM, Steven Haigh schreef:
Thanks for the reply Stephan!
Out of interest, how can I tell what version is installed? The system is EL6.2 - but dovecot etc is installed via yum.
It currently has: # rpm -qa | grep dovecot dovecot-2.0.9-2.el6_1.1.x86_64 dovecot-pigeonhole-2.0.9-2.el6_1.1.x86_64 dovecot-mysql-2.0.9-2.el6_1.1.x86_64
However these look nothing like the pigeonhole version numbers. I can see a few newer packages here and there, but some guidance would be helpful for upgrading either both dovecot & managesieve etc, or just managesieve.
I should have mentioned that right away: Pigeonhole 0.3.x is for Dovecot v2.1
I'd just like to say a quick thanks to Stephan for his help.
I've built 2.1.8 using an updated .spec from the older ATRPMs src.rpm and also built 0.3.1 of dovecot-pigeonhole.
The Extensions section of the Server Sieve Capabilities shows editheader now as well as a couple of others. I've made the modifications using the example posted by Stephan earlier in this thread.
I'm wondering how the regex works. ie: I've used: if header :regex "subject" "\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)"
Will this also match a subject of "Re: [SCIENTIFIC-LINUX-DEVEL] ...." as well?
I'm a bit unsure how the matching will work in this case.
-- Steven Haigh
Email: netwiz@crc.id.au Web: http://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897 Fax: (03) 8338 0299
On 7/26/2012 12:08 PM, Steven Haigh wrote:
On 25/07/2012 7:12 PM, Stephan Bosch wrote:
I'd just like to say a quick thanks to Stephan for his help.
I've built 2.1.8 using an updated .spec from the older ATRPMs src.rpm and also built 0.3.1 of dovecot-pigeonhole.
The Extensions section of the Server Sieve Capabilities shows editheader now as well as a couple of others. I've made the modifications using the example posted by Stephan earlier in this thread.
I'm wondering how the regex works. ie: I've used: if header :regex "subject" "\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)"
Will this also match a subject of "Re: [SCIENTIFIC-LINUX-DEVEL] ...." as well?
I'm a bit unsure how the matching will work in this case.
Well, it will match in that case. But my example will also remove the 'Re:' prefix in that case: there is no '^' at the beginning of the regex, so the regex can match somewhere in the middle of the subject. You can adjust the regex to match a 'Re:' prefix (and whatever else you want to allow) and retain that in a match variable as well:
require ["fileinto", "editheader", "variables", "regex"];
if address "sender" "owner-scientific-linux-devel@LISTSERV.FNAL.GOV" { if header :regex "subject" "((Re|Fwd): *)\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)" { deleteheader "Subject"; addheader "Subject" "${1}${3}"; } addheader "List-Post" "mailto:scientific-linux-devel@fnal.gov";
fileinto "Mail List.SL-Devel";
}
Something like that.
Regards,
Stephan.
participants (2)
-
Stephan Bosch
-
Steven Haigh