1 |
diff -Nur --no-dereference smeserver-unjunkmgr-3.1.old/root/usr/local/unjunkmgr/spamreminder.pl smeserver-unjunkmgr-3.1/root/usr/local/unjunkmgr/spamreminder.pl |
2 |
--- smeserver-unjunkmgr-3.1.old/root/usr/local/unjunkmgr/spamreminder.pl 2020-11-24 05:32:46.000000000 -0500 |
3 |
+++ smeserver-unjunkmgr-3.1/root/usr/local/unjunkmgr/spamreminder.pl 2021-06-01 11:30:11.725000000 -0400 |
4 |
@@ -44,53 +44,53 @@ |
5 |
my %db_conf = $db->get('unjunkmgr')->props; |
6 |
|
7 |
while ( my ( $parameter, $value ) = each(%db_conf) ) { |
8 |
- if ( $parameter eq 'enabled' ) { |
9 |
- $enabled = $value; |
10 |
- } |
11 |
- if ( $parameter eq 'adminemails' and uc($value) eq 'YES' ) { |
12 |
- $admin_email_addr = 'admin'; |
13 |
+ if ( $parameter eq 'enabled' ) { |
14 |
+ $enabled = $value; |
15 |
+ } |
16 |
+ if ( $parameter eq 'adminemails' and uc($value) eq 'YES' ) { |
17 |
+ $admin_email_addr = 'admin'; |
18 |
+ } |
19 |
+ if ( $parameter eq 'unjunkhost' ) { |
20 |
+ $unjunkhost = $value; |
21 |
+ } |
22 |
+ if ( $parameter eq 'useremails' ) { |
23 |
+ $useremails = $value; |
24 |
+ } |
25 |
+ |
26 |
+} |
27 |
|
28 |
- if ( $parameter eq 'unjunkhost' ) { |
29 |
- $unjunkhost = $value; |
30 |
- } |
31 |
- if ( $parameter eq 'useremails' ) { |
32 |
- $useremails = $value; |
33 |
- } |
34 |
- |
35 |
- } |
36 |
- |
37 |
- # The address from which the weekly summary comes from |
38 |
- my $spamfilter_addr = 'Admin Junk Summary <UnJunkManager>'; |
39 |
+# The address from which the weekly summary comes from |
40 |
+my $spamfilter_addr = 'Admin Junk Summary <UnJunkManager>'; |
41 |
|
42 |
- # Which stylesheet to use for the summary email |
43 |
- my $css_file = '/usr/local/unjunkmgr/unjunkmgr.css'; |
44 |
+# Which stylesheet to use for the summary email |
45 |
+my $css_file = '/usr/local/unjunkmgr/unjunkmgr.css'; |
46 |
|
47 |
- # Debug enabled? - will send all reports to $admin_email_addr |
48 |
- my $debug = 0; |
49 |
+# Debug enabled? - will send all reports to $admin_email_addr |
50 |
+my $debug = 0; |
51 |
############################################################################# |
52 |
|
53 |
- # Parameters for the Junkmail Summary functionality |
54 |
+# Parameters for the Junkmail Summary functionality |
55 |
|
56 |
- my $root_url = sprintf( "http://%s/unjunkmgr", $unjunkhost ); |
57 |
+my $root_url = sprintf( "http://%s/unjunkmgr", $unjunkhost ); |
58 |
|
59 |
- my $path = "/home/e-smith/files/users/"; |
60 |
+my $path = "/home/e-smith/files/users/"; |
61 |
|
62 |
- my $end_path_cur = "/Maildir/.junkmail/cur"; |
63 |
- my $end_path_new = "/Maildir/.junkmail/new"; |
64 |
+my $end_path_cur = "/Maildir/.junkmail/cur"; |
65 |
+my $end_path_new = "/Maildir/.junkmail/new"; |
66 |
|
67 |
- my $sa_dbase = '/home/e-smith/db/configuration'; |
68 |
- my $dbh = esmith::ConfigDB->open($sa_dbase) |
69 |
+my $sa_dbase = '/home/e-smith/db/configuration'; |
70 |
+my $dbh = esmith::ConfigDB->open($sa_dbase) |
71 |
|| die "Unable to open spamassassin configuration dbase."; |
72 |
- my %sa_conf = $dbh->get('spamassassin')->props; |
73 |
+my %sa_conf = $dbh->get('spamassassin')->props; |
74 |
|
75 |
- my $disabled = 0; |
76 |
- my $days_to_keep = 5; |
77 |
- my $spam_mark = 7; |
78 |
- my $spam_discard = 10; |
79 |
- |
80 |
- my $parameter = ""; |
81 |
- my $value = ""; |
82 |
- while ( ( $parameter, $value ) = each(%sa_conf) ) { |
83 |
+my $disabled = 0; |
84 |
+my $days_to_keep = 5; |
85 |
+my $spam_mark = 7; |
86 |
+my $spam_discard = 10; |
87 |
+ |
88 |
+my $parameter = ""; |
89 |
+my $value = ""; |
90 |
+while ( ( $parameter, $value ) = each(%sa_conf) ) { |
91 |
if ( $parameter eq 'status' and not $value eq 'enabled' ) { |
92 |
$disabled = 1; |
93 |
} |
94 |
@@ -103,19 +103,19 @@ |
95 |
if ( $parameter eq 'RejectLevel' ) { |
96 |
$spam_discard = $value; |
97 |
} |
98 |
- } |
99 |
+} |
100 |
|
101 |
- #printf("Enabled = %s\n",$disabled); |
102 |
- #printf("Retention = %s\n",$days_to_keep); |
103 |
- #printf("TagLevel = %s\n",$spam_mark); |
104 |
- #printf("RejectLevel = %s\n",$spam_discard); |
105 |
- |
106 |
- if ( uc($useremails) eq 'YES' or lc($admin_email_addr) eq 'admin' ) { |
107 |
- Junkmail_Reminder(); |
108 |
- } |
109 |
+#printf("Enabled = %s\n",$disabled); |
110 |
+#printf("Retention = %s\n",$days_to_keep); |
111 |
+#printf("TagLevel = %s\n",$spam_mark); |
112 |
+#printf("RejectLevel = %s\n",$spam_discard); |
113 |
+ |
114 |
+if ( uc($useremails) eq 'YES' or lc($admin_email_addr) eq 'admin' ) { |
115 |
+ Junkmail_Reminder(); |
116 |
+} |
117 |
|
118 |
- #All done |
119 |
- exit 0; |
120 |
+#All done |
121 |
+exit 0; |
122 |
|
123 |
############################################################################# |
124 |
# Subroutines ############################################################### |
125 |
@@ -124,7 +124,7 @@ |
126 |
######################################## |
127 |
# Process parms # |
128 |
######################################## |
129 |
- sub parse_arg { |
130 |
+sub parse_arg { |
131 |
my $startdate = shift; |
132 |
my $enddate = shift; |
133 |
my $secsinday = 86400; |
134 |
@@ -154,9 +154,9 @@ |
135 |
|
136 |
return ( $start, $end ); |
137 |
|
138 |
- } |
139 |
+} |
140 |
|
141 |
- sub get_email_details { |
142 |
+sub get_email_details { |
143 |
my $entry = shift; |
144 |
my $score; |
145 |
my $spam; |
146 |
@@ -223,14 +223,14 @@ |
147 |
close(ORIGINAL); |
148 |
|
149 |
return ( $subject, $from, $to, $spam_string ); |
150 |
- } |
151 |
+} |
152 |
|
153 |
################################################################################ |
154 |
# The function serializes a complex datastructure into a safe and compact |
155 |
# single line string. |
156 |
################################################################################ |
157 |
|
158 |
- sub serialize_cmd { |
159 |
+sub serialize_cmd { |
160 |
my $cmd = shift; |
161 |
|
162 |
my $out = $cmd; |
163 |
@@ -239,9 +239,9 @@ |
164 |
$out =~ s/([\;%\r\n])/sprintf("%%%02X", ord($1))/ge; |
165 |
|
166 |
return $out; |
167 |
- } |
168 |
+} |
169 |
|
170 |
- sub Junkmail_Reminder { |
171 |
+sub Junkmail_Reminder { |
172 |
|
173 |
my $found; |
174 |
my $entry; |
175 |
@@ -392,5 +392,5 @@ |
176 |
$msg->send(); |
177 |
} |
178 |
} |
179 |
- } |
180 |
+} |
181 |
|