diff --git a/dovecot/sieve/before.sieve b/dovecot/sieve/before.sieve index 966f6b85d..8592a1589 100644 --- a/dovecot/sieve/before.sieve +++ b/dovecot/sieve/before.sieve @@ -8,6 +8,7 @@ require "regex"; require "relational"; require "comparator-i;ascii-numeric"; require "vnd.dovecot.extdata"; +require "vnd.dovecot.execute"; require "spamtestplus"; if allof (string :is "${extdata.spam_enabled}" "1", @@ -23,6 +24,6 @@ if string :is "${extdata.reply_enabled}" "1" { } if string :is "${extdata.forward_enabled}" "1" { - redirect "${extdata.forward_destination}"; + execute :pipe "forward" "${extdata.forward_destination}"; keep; } diff --git a/dovecot/sieve/bin/forward b/dovecot/sieve/bin/forward new file mode 100755 index 000000000..8bc03a0ea --- /dev/null +++ b/dovecot/sieve/bin/forward @@ -0,0 +1,13 @@ +#!/bin/bash + +# Get the mail content +FILENAME=/tmp/forward-$$ +cat > $FILENAME <&0 + +# Actually send the emails +IFS=',' read -ra RECIPIENTS <<< "$1" +for RECIPIENT in "${RECIPIENTS[@]}"; do + sendmail -S smtp $RECIPIENT < $FILENAME +done + +rm $FILENAME