HOWTO forward e-mail to multiple adress

Author:  Van hees Michel <mvanhees@vanhees.homeip.net>
Contributor:
  
Release supported: SME 5.6
License: GPL
Last updated: Wednesday, September 17, 2003 08:49 AM


Problem:  You want to forward all e-mail from one user to multi other users
Solution:
  Follow this HowTo


STEP 1: Create template directory

Create user custom template for qmail propeties

# mkdir -p /etc/e-smith/templates-user-custom/.qmail

STEP 2: Create custom template for forward e-mail

Edit or create "e-smithForward20"
Your file have to look like ...

#pico /etc/e-smith/templates-user-custom/.qmail/e-smithForward20

{
$OUT = '';

use esmith::config;
use esmith::db;

my %accounts;
tie %accounts, 'esmith::config', '/home/e-smith/accounts';

# get $USERNAME from esmith::config - put there by the
# email-update-user action as a temporary variable
die "Username argument missing." unless defined ($USERNAME);

my $type = db_get_type(\%accounts, $USERNAME);

die
"Account $USERNAME is not a user account; "
. "update email forwarding failed.\n"
unless $type eq 'user';

my $EmailForward = db_get_prop(\%accounts, $USERNAME, "EmailForward");
my $ForwardAddress = db_get_prop(\%accounts, $USERNAME, "ForwardAddress");
my @List;
my $adrFwd;

if ($EmailForward eq "local")
{
$OUT = "./Maildir/\n";
}
elsif ($EmailForward eq 'forward')
{
@List = split(/;/, $ForwardAddress);
foreach $adrFwd (@List) {
$OUT .= "&" . $adrFwd . "\n";
}
}
elsif ($EmailForward eq 'both')
{
@List = split(/;/, $ForwardAddress);
foreach $adrFwd (@List) {
$OUT .= "&" . $adrFwd . "\n";
}
$OUT .= "./Maildir/\n";
}
else
{
# this shouldn't happen - if it does, deliver locally
$OUT = "./Maildir/\n";
}
}


STEP 3: Save the template

<CTRL>-o
<CTRL>-x

STEP 4:  Web panel

When you specified the forwarding e-mail adress,
Enter multi e-mail adress separate by ;

1