Skip to content

Commit

Permalink
Allow forward to multiple destinations, fixes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyou committed Dec 11, 2016
1 parent f2ff1eb commit 692bcda
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dovecot/sieve/before.sieve
Expand Up @@ -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",
Expand All @@ -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;
}
13 changes: 13 additions & 0 deletions 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

1 comment on commit 692bcda

@jkarlosb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

Please sign in to comment.