Quick autoreply and forward setup pages now only show un-conditional rules.
---- Changes since 1.450 ----
Added option to select the character set of automatic reply messages.
+---- Changes since 1.460 ----
+Added a checkbox (on by default) to not forward bounce emails, which can cause mail loops.
# Show page header and get the filter
if ($in{'new'}) {
&ui_print_header(undef, $text{'edit_title1'}, "");
- $filter = { 'actiondefault' => 1 };
+ $filter = { 'actiondefault' => 1,
+ 'nobounce' => 1 };
if ($in{'header'}) {
# Initial filter is based on URL params
$filter->{'condheader'} = $in{'header'};
print &ui_table_row(
&ui_oneradio("amode", 1, $text{'edit_amode1'}, $amode == 1),
&ui_textarea("forward", $amode == 1 ?
- join("\n", split(/,/, $filter->{'action'})) : "", 3, 70),
+ join("\n", split(/,/, $filter->{'action'})) : "", 3, 70).
+ "<br>\n".
+ &ui_checkbox("nobounce", 1, $text{'edit_nobounce'},
+ $filter->{'nobounce'}),
undef, \@tds);
# Save to a folder or file
local @pmrc = &procmail::parse_procmail_file($file || $procmail::procmailrc);
foreach my $r (@pmrc) {
# Check for un-supported recipes
- if (@{$r->{'conds'}} > 1 ||
- $r->{'block'} ||
- $r->{'name'}) {
+ local @conds = @{$r->{'conds'}};
+ if ($r->{'block'} || $r->{'name'}) {
next;
}
# Check for flags
local %flags = map { $_, 1 } @{$r->{'flags'}};
+ # Check for bounce condition
+ local $nobounce;
+ if (@conds && $conds[0]->[0] eq '!' &&
+ $conds[0]->[1] =~ /FROM_MAILER/) {
+ $nobounce = 1;
+ shift(@conds);
+ }
+ next if (@conds > 1); # Multiple conditions are not supported
+
# Work out condition type
local ($condtype, $cond);
- if (@{$r->{'conds'}}) {
- ($condtype, $cond) = @{$r->{'conds'}->[0]};
+ if (@conds) {
+ ($condtype, $cond) = @{$conds[0]};
if ($condtype && $condtype ne "<" && $condtype ne ">") {
# Unsupported conditon type
next;
'continue' => $flags{'c'},
'actiontype' => $r->{'type'},
'action' => $r->{'action'},
+ 'nobounce' => $nobounce,
'index' => scalar(@rv),
'recipe' => $r };
elsif ($filter->{'cond'}) {
@conds = ( [ "", $filter->{'cond'} ] );
}
-$recipe->{'conds'} = \@conds;
# Set action section
if ($filter->{'actionspam'}) {
# Enable locking for file delivery
$recipe->{'lockfile'} ||= "";
}
+ if ($filter->{'actiontype'} eq '!' && $filter->{'nobounce'}) {
+ # Add condition to suppress forwarding of bounces
+ unshift(@conds, [ '!', '^FROM_MAILER' ]);
+ }
}
+$recipe->{'conds'} = \@conds;
# Set flags
push(@flags, "B") if ($filter->{'body'});
edit_continue=Continue with other filter rules, even after applying this action
edit_amode6=Send automatic reply
edit_amode7=Save to new folder named
+edit_nobounce=Suppress forwarding of bouce messages
save_err=Failed to save filter
save_econdheader=Missing or invalid email header
$in{'forward'} =~ s/\s+/,/g;
$filter->{'action'} = $in{'forward'};
$filter->{'actiontype'} = '!';
+ $filter->{'nobounce'} = $in{'nobounce'};
}
elsif ($in{'amode'} == 0) {
# Write to a folder or file
# Create or update
if (!$filter) {
$filter = { 'actiontype' => '!',
- 'body' => 0 };
+ 'body' => 0,
+ 'nobounce' => 1 };
}
$filter->{'continue'} = $in{'continue'};
$in{'forward'} =~ /\S/ || &error($text{'save_eforward'});