How to configure mail-filter plugin

刘莹莹 576709166 at qq.com
Mon Feb 10 04:07:14 EET 2020


I config mail-filter plugin like https://wiki2.dovecot.org/Plugins/MailFilter describe, but error occurred

mail-filter plugin config in dovecot.conf:
mail_plugins = mail_filter
plugin {
  mail_filter = mail-filter %u # %u = username given to the script as first
  mail_filter_out = mail-filter-out %u
}

service mail-filter {
  executable = script /usr/local/bin/mail-filter.sh
  user = vmail
  group = vmail
  unix_listener mail-filter {
    mode = 0666
    user = vmail
    group = vmail
  }
}

service mail-filter-out {
 executable = script /usr/local/bin/mail-filter-out.sh
 user = vmail
 group = vmail
 unix_listener mail-filter-out {
   mode = 0666
   user = vmail
   group = vmail
 }
}

vim  /usr/local/bin/mail-filter.sh
touch /tmp/testfile
cat  >  /tmp/tempfile
cat /tmp/tempfile


vim /usr/local/bin/mail-filter-out.sh
cat > /tmp/tempfile
cat /tmp/tempfile

then "dovecot-lda -f q1 at a.com -d q1 at a.com < test.eml"
Error log:
Feb 10 10:00:21 lda(q1 at a.com)<18794><9ZN8EzW5QF5qSQAA0J78UA>: Debug: Namespace : Using permissions from /home/a.com/q1: mode=0700 gid=default
Feb 10 10:00:21 lda(q1 at a.com)<18794><9ZN8EzW5QF5qSQAA0J78UA>: Panic: file ostream.c: line 201 (o_stream_flush): assertion failed: (stream->stream_errno != 0)
Feb 10 10:00:21 lda(q1 at a.com)<18794><9ZN8EzW5QF5qSQAA0J78UA>: Error: Raw backtrace: /usr/lib64/dovecot/libdovecot.so.0(backtrace_append+0x42) [0x7f049f4ef582] -> /usr/lib64/dovecot/libdovecot.so.0(backtrace_get+0x1e) [0x7f049f4ef68e] -> /usr/lib64/dovecot/libdovecot.so.0(+0xe4b6e) [0x7f049f4f9b6e] -> /usr/lib64/dovecot/libdovecot.so.0(+0xe4bb1) [0x7f049f4f9bb1] -> /usr/lib64/dovecot/libdovecot.so.0(i_fatal+0) [0x7f049f4565e8] -> /usr/lib64/dovecot/libdovecot.so.0(+0x10bc47) [0x7f049f520c47] -> /usr/lib64/dovecot/libdovecot-storage.so.0(dbox_save_end+0x35) [0x7f049f8262f5] -> /usr/lib64/dovecot/libdovecot-storage.so.0(mdbox_save_finish+0x39) [0x7f049f81af99] -> /usr/lib64/dovecot/libdovecot-lda.so.0(+0x3fbe) [0x7f049fb0efbe] -> /usr/lib64/dovecot/libdovecot-storage.so.0(mailbox_save_finish+0x73) [0x7f049f801493] -> /usr/lib64/dovecot/libdovecot-storage.so.0(mail_storage_copy+0xc9) [0x7f049f7f38e9] -> /usr/lib64/dovecot/libdovecot-storage.so.0(mdbox_copy+0x46) [0x7f049f81b816] -> /usr/lib64/dovecot/libdovecot-lda.so.0(+0x3daa) [0x7f049fb0edaa] -> /usr/lib64/dovecot/libdovecot-storage.so.0(+0x4e87c) [0x7f049f80187c] -> /usr/lib64/dovecot/libdovecot-lda.so.0(mail_deliver_save+0x1d7) [0x7f049fb103e7] -> /usr/lib64/dovecot/libdovecot-lda.so.0(mail_deliver+0x2fe) [0x7f049fb10bfe] -> /usr/libexec/dovecot/dovecot-lda(main+0x615) [0x55f636880045] -> /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f049f073c05] -> /usr/libexec/dovecot/dovecot-lda(+0x3b7e) [0x55f636880b7e]


More information about the dovecot mailing list