Skip to content

Commit 513e831

Browse files
authored
Merge pull request #1508 from ikedas/issue-1354 by ikedas
Use DSN for the message to notify moderation
2 parents eafdeaf + 84e4d6b commit 513e831

File tree

5 files changed

+28
-36
lines changed

5 files changed

+28
-36
lines changed

default/mail_tt2/delivery_status_notification.tt2

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[%# delivery_status_notification.tt2 ~%]
22
Content-Type: multipart/report; report-type=delivery-status;
33
boundary="[% boundary %]"
4-
[% IF action == "delivered" -%]
5-
Subject: [%"Message was successfully delivered"|loc|qencode%]
4+
[% IF status == '2.3.0' || status == '4.3.0' -%]
5+
Subject: [%"Message distribution: Forwarded"|loc|qencode%]
66
[% ELSIF status == '4.2.1' -%]
77
Subject: [%"List could not be created"|loc|qencode%]
88
[% ELSIF status == '4.2.4' -%]
@@ -25,6 +25,8 @@ Subject: [%"Cannot personalize message"|loc|qencode%]
2525
Subject: [%"A virus in your mail"|loc|qencode%]
2626
[% ELSIF status == '5.7.1' -%]
2727
Subject: [%"Message distribution: Authorization denied"|loc|qencode%]
28+
[% ELSIF action == "delivered" -%]
29+
Subject: [%"Message was successfully delivered"|loc|qencode%]
2830
[% ELSE -%]
2931
Subject: [%"Delivery Status Notification: %1"|loc(action)|qencode%]
3032
[% END -%]
@@ -37,7 +39,10 @@ Content-Disposition: inline
3739
Content-Description: Notification
3840

3941
[%|loc%]This is an automatic response sent by Sympa Mailing Lists Manager.[%END%]
40-
[% IF action == "delivered" -%]
42+
[% IF status == '2.3.0' || status == '4.3.0' -%]
43+
[%|loc(listname)%]Your message to the list '%1' has been forwarded to the moderator(s)[%END%]
44+
45+
[% ELSIF action == "delivered" -%]
4146
[%|loc%]Message was successfully delivered to following address:[%END%]
4247

4348
[% recipient %]
@@ -143,8 +148,11 @@ Remote-MTA: dns; [% domain %]
143148
Diagnostic-Code: X-Sympa; [% diagnostic_code %]
144149

145150
--[% boundary %]
146-
[%# Attach only header part of potentially unsafe contents. ~%]
147-
[% IF status == '5.1.1' || status == '5.1.2'
151+
[%# Attach only header part of potentially unsafe contents.
152+
# And, 2.1.5, 2.3.0 and 4.3.0 are successful stata and don't need copy of
153+
# message content. ~%]
154+
[% IF status == '2.1.5' || status == '2.3.0' || status == '4.3.0'
155+
|| status == '5.1.1' || status == '5.1.2'
148156
|| status == '5.2.3' || status == '5.7.0' -%]
149157
Content-Type: text/rfc822-headers
150158
Content-Disposition: inline

default/mail_tt2/message_report.tt2

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
~%]
66
Subject: [%"Message distribution"|loc|qencode%]
77

8-
[% IF entry == 'moderating_message' -%]
9-
[%|loc(list.name)%]Your message to the list '%1' has been forwarded to the moderator(s)[%END%]
10-
[% ELSIF entry == 'message_distributed' -%]
8+
[% IF entry == 'message_distributed' -%]
119
[%|loc(key,list.name)%]Message %1 for list '%2' has been distributed.[%END%]
1210
[% ELSIF entry == 'message_rejected' -%]
1311
[%|loc(key,list.name)%]Message %1 for list '%2' has been rejected.[%END%]

src/lib/Sympa.pm

+8-1
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,14 @@ my %diag_messages = (
252252
'default' => 'Other undefined Status',
253253
# success
254254
'2.1.5' => 'Destination address valid',
255+
# forwarded to moderators
256+
'2.3.0' => 'Other or undefined mail system status',
255257
# no available family, dynamic list creation failed, etc.
256258
'4.2.1' => 'Mailbox disabled, not accepting messages',
257259
# no subscribers in dynamic list
258260
'4.2.4' => 'Mailing list expansion problem',
261+
# held for moderation
262+
'4.3.0' => 'Other or undefined mail system status',
259263
# unknown list address
260264
'5.1.1' => 'Bad destination mailbox address',
261265
# unknown robot
@@ -336,7 +340,10 @@ sub send_dsn {
336340
# Diagnostic message.
337341
$diag ||= $diag_messages{$status} || $diag_messages{'default'};
338342
# Delivery result, "failed" or "delivered".
339-
my $action = (index($status, '2') == 0) ? 'delivered' : 'failed';
343+
my $action =
344+
($status eq '4.3.0') ? 'delayed'
345+
: (0 == index $status, '2') ? 'delivered'
346+
: 'failed';
340347

341348
# Attach original (not decrypted) content.
342349
my $msg_string = $message->as_string(original => 1);

src/lib/Sympa/Spindle/ToEditor.pm

+3-13
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,9 @@ sub _twist {
8989
);
9090

9191
# Do not report to the sender if the message was tagged as a spam.
92-
unless ($self->{quiet} or $message->{'spam_status'} eq 'spam') {
93-
# Ensure 1 second elapsed since last message.
94-
Sympa::send_file(
95-
$list,
96-
'message_report',
97-
$sender,
98-
{ type => 'success', # Compat. <=6.2.12.
99-
entry => 'moderating_message',
100-
auto_submitted => 'auto-replied'
101-
},
102-
date => time + 1
103-
);
104-
}
92+
Sympa::send_dsn($list, $message, {}, '2.3.0')
93+
unless $self->{quiet}
94+
or $message->{'spam_status'} eq 'spam';
10595
return 1;
10696
}
10797

src/lib/Sympa/Spindle/ToModeration.pm

+3-14
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,9 @@ sub _twist {
9595
Time::HiRes::time() - $self->{start_time}
9696
);
9797

98-
# Do not report to the sender if the message was tagged as a spam.
99-
unless ($self->{quiet} or $message->{'spam_status'} eq 'spam') {
100-
# Ensure 1 second elapsed since last message.
101-
Sympa::send_file(
102-
$list,
103-
'message_report',
104-
$sender,
105-
{ type => 'success', # Comapt. <=6.2.12.
106-
entry => 'moderating_message',
107-
auto_submitted => 'auto-replied'
108-
},
109-
date => time + 1
110-
);
111-
}
98+
Sympa::send_dsn($list, $message, {}, '4.3.0')
99+
unless $self->{quiet}
100+
or $message->{'spam_status'} eq 'spam';
112101
return 1;
113102
}
114103

0 commit comments

Comments
 (0)