[Dovecot] Sieve envelope :detail "to" "extention" does not deliver to fileinto destination
Dear Listmember.
I resend this with different Subject so that the spamfilter does not drop the mail, I hope ;-)
I try to migrate from my current courier-mta setup fo postfix dovecot setup.
I use the following scirpt to filter to the destination mailbox.
### /var/vmail/none.at/al/.dovecot.sieve # from http://wiki.dovecot.org/LDA/Sieve require ["fileinto", "envelope", "subaddress", "include"];
include "lists.sieve";
if envelope :detail "to" "work" { fileinto "INBOX.work"; } ###
### /var/vmail/none.at/al/sieve/lists.sieve require ["fileinto", "subaddress", "envelope" ];
if envelope :detail "to" "pdnsusers" { fileinto "Lists.pdnsusers"; } ###
postfix/master
### dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${original_recipient} # flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -m ${extension} -a ${original_recipient} ###
Log ### Sep 11 21:47:48 lvps46-163-74-15 postfix/smtpd[7788]: connect from
Sep 11 21:48:12 lvps46-163-74-15 postfix/smtpd[7788]: 495EF9FECAF9:
Sep 11 21:48:27 lvps46-163-74-15 postfix/cleanup[7795]: 495EF9FECAF9: message-id=<> Sep 11 21:48:27 lvps46-163-74-15 postfix/qmgr[7785]: 495EF9FECAF9: from=<al@bitrace.net>, size=268, nrcpt=1 (queue active) Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda: Debug: Loading modules from directory: /usr/lib/dovecot/modules Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda: Debug: Module loaded: /usr/lib/dovecot/modules/lib90_sieve_plugin.so Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda: Debug: auth input: al@none.at uid=5000 gid=5000 home=/var/vmail/none.at/al Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: Effective uid=5000, gid=5000, home=/var/vmail/none.at/al Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: maildir: root exists (/var/vmail/none.at/al/Maildir) Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: maildir++: root=/var/vmail/none.at/al/Maildir, index=, control=, inbox=/var/vmail/none.at/al/Maildir, alt= Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: none: root=, index=, control=, inbox=, alt= Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: Destination address: al-pdnsuser@none.at (source: -a parameter) Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: using sieve path for user's script: /var/vmail/none.at/al/.dovecot.sieve Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: opening script /var/vmail/none.at/al/.dovecot.sieve Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: script binary /var/vmail/none.at/al/.dovecot.svbin successfully loaded Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: binary save: not saving binary /var/vmail/none.at/al/.dovecot.svbin, because it is already stored Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: executing script from /var/vmail/none.at/al/.dovecot.svbin Sep 11 21:48:27 lvps46-163-74-15 dovecot: lda(al@none.at): sieve: msgid=unspecified: stored mail into mailbox 'INBOX' Sep 11 21:48:27 lvps46-163-74-15 postfix/pipe[7797]: 495EF9FECAF9: to=<al-pdnsuser@none.at>, relay=dovecot, delay=28, delays=28/0.02/0/0.22, dsn=2.0.0, status=sent (delivered via dovecot service) Sep 11 21:48:27 lvps46-163-74-15 postfix/qmgr[7785]: 495EF9FECAF9: removed Sep 11 21:48:28 lvps46-163-74-15 postfix/smtpd[7788]: disconnect from xxx ###
dovecot -n => attachment dovecot_-n
~#: egrep -v '^(#|$)' /etc/dovecot/dovecot-sql.conf
####
driver = mysql
connect = host=127.0.0.1 dbname=mailserver user=$USER
password=$PASSWORD
default_pass_scheme = PLAIN-MD5
password_query = SELECT user_email AS user,
user_password AS password
FROM virtual_users WHERE user_email='%u';
####
Due to the fact that I'am new to dovecot and sieve I hope anybody can help the solve this issue.
My target is to filter the mailinglists based on address extention or is it better to filter on to header?
Is there a 'log' or 'print' command in the sieve filter or how can I write a message to the log file?
Many thanks for your help
BR Aleks
On Mon, 12 Sep 2011 19:14:48 +0200 Aleksandar Lazic articulated:
<snip>
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${original_recipient} # flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -m ${extension} -a ${original_recipient}
I use plus addressing and this is the entry in the master.cf file from Postfix:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${recipient}
The "argv" could be different on your system; however the rest should be the same as mine I would assume. If you do make a change, you will have to restart Postfix for it to take effect.
-- Jerry ✌ Dovecot.user@seibercom.net
Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header.
Dear Jerry,
On Mon 12.09.2011 14:22, Jerry wrote:
On Mon, 12 Sep 2011 19:14:48 +0200 Aleksandar Lazic articulated:
<snip>
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${original_recipient} # flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -m ${extension} -a ${original_recipient}
I use plus addressing and this is the entry in the master.cf file from Postfix:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${recipient}
The "argv" could be different on your system; however the rest should be the same as mine I would assume. If you do make a change, you will have to restart Postfix for it to take effect.
thanks for your info. I have changed the -a to recipient but nothing changed.
I have now changed the if statement to
### if header :contains "Delivered-To" "pdnsusers" { ###
this works, but the best would be to be able to use
### if envelope :contains :detail "to" "pdnsusers" { ###
Is there a command like 'print envelope' or something else to see what variables and envelope deliver have?
Here is the log, maybe you can see more the I ;-)
### Sep 13 00:33:18 lvps46-163-74-15 postfix/smtpd[6011]: connect from localhost.localdomain[127.0.0.1] Sep 13 00:33:52 lvps46-163-74-15 postfix/smtpd[6011]: B1EFE9FECC15: client=localhost.localdomain[127.0.0.1] Sep 13 00:34:12 lvps46-163-74-15 postfix/cleanup[5999]: B1EFE9FECC15: message-id=<20110912223352.B1EFE9FECC15@external.non e.at> Sep 13 00:34:12 lvps46-163-74-15 postfix/qmgr[22260]: B1EFE9FECC15: from=<al@bitrace.net>, size=357, nrcpt=1 (queue active) Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda: Debug: Loading modules from directory: /usr/lib/dovecot/modules Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda: Debug: Module loaded: /usr/lib/dovecot/modules/lib15_notify_plugin.so Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda: Debug: Module loaded: /usr/lib/dovecot/modules/lib20_mail_log_plugin.so Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda: Debug: Module loaded: /usr/lib/dovecot/modules/lib90_sieve_plugin.so Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda: Debug: auth input: al@none.at uid=5000 gid=5000 home=/var/vmail/none.at/al Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: Effective uid=5000, gid=5000, home=/var/vmail/none.at/al Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: maildir: root exists (/var/vmail/none.at/al/Maildir) Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: maildir++: root=/var/vmail/none.at/al/Maildir, index=, control=, inbox=/var/vmail/none.at/al/Maildir, alt= Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: none: root=, index=, control=, inbox=, alt= Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: Destination address: al-pdnsusers@none.at (source: -a parameter) Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: using sieve path for user's script: /var/vmail/none.at/al/.dovecot.sieve Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: opening script /var/vmail/none.at/al/.dovecot.sieve Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: script binary /var/vmail/none.at/al/.dovecot.svbin successfully loaded Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: binary save: not saving binary /var/vmail/none.at/al/.dovecot.svbin, because it is already stored Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): Debug: sieve: executing script from /var/vmail/none.at/al/.dovecot.svbin Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): save: box=INBOX, uid=61, msgid=<20110912223352.B1EFE9FECC15@external.none.at>, size=412 Sep 13 00:34:12 lvps46-163-74-15 dovecot: lda(al@none.at): sieve: msgid=<20110912223352.B1EFE9FECC15@external.none.at>: stored mail into mailbox 'INBOX' Sep 13 00:34:12 lvps46-163-74-15 postfix/pipe[6001]: B1EFE9FECC15: to=<al-pdnsusers@none.at>, relay=dovecot, delay=28, delays=28/0/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service) Sep 13 00:34:12 lvps46-163-74-15 postfix/qmgr[22260]: B1EFE9FECC15: removed Sep 13 00:34:14 lvps46-163-74-15 postfix/smtpd[6011]: disconnect from localhost.localdomain[127.0.0.1] ###
On Tue, 13 Sep 2011 00:42:44 +0200 Aleksandar Lazic articulated:
Dear Jerry,
On Mon 12.09.2011 14:22, Jerry wrote:
On Mon, 12 Sep 2011 19:14:48 +0200 Aleksandar Lazic articulated:
<snip>
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${original_recipient} # flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -m ${extension} -a ${original_recipient}
I use plus addressing and this is the entry in the master.cf file from Postfix:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -a ${recipient}
The "argv" could be different on your system; however the rest should be the same as mine I would assume. If you do make a change, you will have to restart Postfix for it to take effect.
thanks for your info. I have changed the -a to recipient but nothing changed.
I have now changed the if statement to
### if header :contains "Delivered-To" "pdnsusers" { ###
this works, but the best would be to be able to use
### if envelope :contains :detail "to" "pdnsusers" { ###
Is there a command like 'print envelope' or something else to see what variables and envelope deliver have?
This is what I use, and it works fine. The example is something I use for FreeBSD.
Example address: user+fbsd@example.com
This is my sieve recipe:
if envelope :detail "To" "fbsd" {fileinto "FreeBSD"; stop;}
I hope this helps.
-- Jerry ✌ Dovecot.user@seibercom.net
Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header.
Quidquid latine dictum sit, altum viditur.
(Whatever is said in Latin sounds profound.)
On Mon 12.09.2011 19:17, Jerry wrote:
On Tue, 13 Sep 2011 00:42:44 +0200 Aleksandar Lazic articulated:
[snip]
### if envelope :contains :detail "to" "pdnsusers" { ###
Is there a command like 'print envelope' or something else to see what variables and envelope deliver have?
This is what I use, and it works fine. The example is something I use for FreeBSD.
Example address: user+fbsd@example.com
This is my sieve recipe:
if envelope :detail "To" "fbsd" {fileinto "FreeBSD"; stop;}
I hope this helps.
Thanks for you help.
I haven't solved the issue, I moved to
if header :contains "to" "pdnsusers" { fileinto "Lists.pdnsusers"; }
Cheers Aleks
Op 12-9-2011 19:14, Aleksandar Lazic schreef:
Is there a 'log' or 'print' command in the sieve filter or how can I write a message to the log file?
With the latest Pigeonhole (0.2.4), you can use the vnd.dovecot.debug extension (which is not available by default and therefore needs to be added to sieve_extensions), e.g.
=== require "vnd.dovecot.debug"; require "envelope"; require "variables";
if envelope :matches "to" "*" { debug_log "envelope to `${1}'"; }
A message should be logged to the user's personal log file (typically ~/.dovecot.sieve.log), e.g:
=== sieve: info: started log at Sep 15 11:27:26. main_script: line 6: info: DEBUG: envelope to = `user@example.com'. info: msgid=3453453534r42@example.com: stored mail into mailbox 'INBOX'.
Regards,
Stephan.
Dear Stephan,
On Don 15.09.2011 11:29, Stephan Bosch wrote:
Op 12-9-2011 19:14, Aleksandar Lazic schreef:
Is there a 'log' or 'print' command in the sieve filter or how can I write a message to the log file?
With the latest Pigeonhole (0.2.4), you can use the vnd.dovecot.debug extension (which is not available by default and therefore needs to be added to sieve_extensions), e.g.
=== require "vnd.dovecot.debug"; require "envelope"; require "variables";
if envelope :matches "to" "*" { debug_log "envelope to `${1}'"; }
[snipp]
Thank you.
debug_log "envelope to ${1}'"; debug_log "envelope to detail
${detail}'"; <= is this a default
variable?
I get
sieve: info: started log at Sep 15 21:07:07.
lists.sieve: line 15: info: DEBUG: envelope to al-pdnsusers@none.at'. lists.sieve: line 16: info: DEBUG: envelope to detail
'.
info: msgid=<20110915190707.256ED9FECC31@external.none.at>: stored mail
into mailbox 'Lists.pdnsusers'.
Is there a possibility to print the :detail from the subaddress module? Maybe like
Pseudocode:
set "detail" :detail if :detail not empty
Is there a possibility to dump all variables? Are there any default variables in variables module?
What does I make wrong that I haven't the :detail from the subaddress?!
BR Aleks
Hi Aleksandar, Op 15-9-2011 21:13, Aleksandar Lazic schreef:
Dear Stephan,
[...] debug_log "envelope to `${1}'"; debug_log "envelope to detail `${detail}'"; <= is this a default variable?
Eh, no.
I get === sieve: info: started log at Sep 15 21:07:07. lists.sieve: line 15: info: DEBUG: envelope to `al-pdnsusers@none.at'. lists.sieve: line 16: info: DEBUG: envelope to detail `'. info: msgid=<20110915190707.256ED9FECC31@external.none.at>: stored mail into mailbox 'Lists.pdnsusers'. ===
Is there a possibility to print the :detail from the subaddress module? Maybe like
Pseudocode: === set "detail" :detail if :detail not empty ===
Let's just print all relevant stuff: === require "vnd.dovecot.debug"; require "envelope"; require "variables"; require "subaddress"; if envelope :matches "to" "*" { debug_log "envelope to `${1}'"; } if envelope :localpart :matches "to" "*" { debug_log "envelope to; localpart `${1}'"; } if envelope :user :matches "to" "*" { debug_log "envelope to; user `${1}'"; } /* This will print nothing if there is no detail */ if envelope :detail :matches "to" "*" { debug_log "envelope to; detail `${1}'"; } === Yielding, e.g.: === main_script: line 6: info: DEBUG: envelope to `stephan-frop@rename-it.nl'. main_script: line 7: info: DEBUG: envelope to; localpart `stephan-frop'. main_script: line 8: info: DEBUG: envelope to; user `stephan'. main_script: line 9: info: DEBUG: envelope to; detail `frop'. info: msgid=unspecified: stored mail into mailbox 'INBOX'. ===
Is there a possibility to dump all variables? Are there any default variables in variables module?
There are no variables defined other than those that you define (using the set command or implicitly for match values).
What does I make wrong that I haven't the :detail from the subaddress?!
My guess is that you need to add the recipient_delimiter setting to the plugin section also: plugin { recipient_delimiter = - } Matbe this should be unified somehow. Regards, Stephan.
Dear Stephan,
On Sam 17.09.2011 01:30, Stephan Bosch wrote:
Op 16-9-2011 23:35, Stephan Bosch schreef:
My guess is that you need to add the recipient_delimiter setting to the plugin section also:
plugin { recipient_delimiter = - }
Matbe this should be unified somehow.
This should be fixed in hg now.
Your guess was right, thanks. Thanks also that the next release will use the global recipient_delimiter.
Aleks
participants (3)
-
Aleksandar Lazic
-
Jerry
-
Stephan Bosch