Commit cfee63e5 authored by david.verdin's avatar david.verdin
Browse files

Change: When a problem occurs while handling a bounce, the message is saved to...

Change: When a problem occurs while handling a bounce, the message is saved to a "spool/bounce/bad" directory.


git-svn-id: https://subversion.renater.fr/sympa/trunk@4741 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 04f35427
......@@ -112,6 +112,14 @@ Subject: [% FILTER qencode %][%|loc%]A message archiving failed[%END%][%END%]
[%|loc(file,bad)%]Sympa could not archive message '%1'. Moving it into directory '%2'.[%END%]
[%|loc%]See logs for more details.[%END%]
[% ELSIF type == 'bounce_management_failed' -%]
Subject: [% FILTER qencode %][%|loc%]A bounce management failed[%END%][%END%]
[%|loc(file,bad)%]Sympa could not handle bounce message '%1'. Moving it into directory '%2'.[%END%]
[%|loc(error)%]Error: %1[%END%]
[%|loc%]See logs for more details.[%END%]
[% ELSIF type == 'edit_list_error' -%]
Subject: [% FILTER qencode %][%|loc%]incorrect format of edit_list.conf[%END%][%END%]
......
......@@ -202,6 +202,7 @@ while (!$end) {
foreach my $file (@files) {
last if $end;
next unless (-f "$queue/$file");
unless ($file =~ /^(\S+)\.\d+\.\d+$/) {
my @s = stat("$queue/$file");
......@@ -374,13 +375,16 @@ while (!$end) {
}
}else{
$forward = 'listmaster';
do_log ('err','ignoring Feedback Report %s : unknown format (feedback_type:%s, original_rcpt:%s, listname:%s)',$file, $feedback_type, $original_rcpt, $listname );
&ignore_bounce({'file' => $file,
'robot' => $robot,
'queue' => $queue,
'error' => "Unknown format (feedback_type:$feedback_type, original_rcpt:$original_rcpt, listname:$listname)",
});
}
if (-f "$queue/$file") {
unlink("$queue/$file");
}
$listname ||= 'sympa';
&DoForward($listname, $forward, $robot, $entity) if (defined $forward);
unlink("$queue/$file");
next;
}
......@@ -480,8 +484,11 @@ while (!$end) {
unless (unlink("$queue/$file")) {
do_log ('err',"Could not remove $queue/$file ; $0 might NOT be running with the right UID or file was not created with the right UID");
&do_log('err',"Renaming file to $queue/BAD-$file.");
rename "$queue/$file", "$queue/BAD-$file";
&ignore_bounce({'file' => $file,
'robot' => $robot,
'queue' => $queue,
'error' => "Could not remove $queue/$file ; $0 might NOT be running with the right UID or file was not created with the right UID",
});
last;
}
}
......@@ -591,6 +598,28 @@ sub update_subscriber_bounce_history {
}
}
## If bounce can't be handled correctly, saves it to the "bad" subdirectory of the bounce spool and notifies listmaster.
sub ignore_bounce {
my $param = shift;
my $file = $param -> {'file'};
my $error = $param -> {'error'};
my $queue = $param -> {'queue'};
my $robot = $param -> {'robot'};
&tools::save_to_bad({
'file' => $file,
'hostname' => $robot,
'queue' => $queue,
});
unless (&List::send_notify_to_listmaster('bounce_management_failed',$robot,{'file' => $file,
'bad' => "$queue/bad",
'error' => $error,
})) {
&do_log('notice',"Unable to send notify 'bounce_management_failed' to listmaster");
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment