@@ -78,10 +78,10 @@ def find_blocked_mail(blocked_mail, earliest_timestamp, f):
78
78
#line_match = re.search('(?P<date>[A-Z][a-z][a-z]\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}).*amavis\[\d+\].*Blocked (?P<reason>\w+).* <(?P<from>[^<>]+)> -> (?P<to><[^<>]+>)+, quarantine: (?P<filename>[^,]+), Message-ID:', line)
79
79
line_match = re .match (r'(?P<date>[A-Z][a-z][a-z]\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}).*amavis\[\d+\].*Blocked (?P<reason>\w+).* <(?P<from>[^<>]+)> -> (?P<to>(<[^<>]+>,?)+), quarantine: (?P<filename>[^,]+),' , line )
80
80
if not line_match == None :
81
- #print "Matched"
82
- #print "to: " + line_match.group("to")
83
- #print line
84
- #print "date:", line_match.group("date"), "reason:", line_match.group("reason"), "from:", line_match.group("from"), "to:", line_match.group("to"), "filename:", line_match.group("filename")
81
+ #print( "Matched")
82
+ #print( "to: " + line_match.group("to") )
83
+ #print( line)
84
+ #print( "date:", line_match.group("date"), "reason:", line_match.group("reason"), "from:", line_match.group("from"), "to:", line_match.group("to"), "filename:", line_match.group("filename") )
85
85
dropped_message = DroppedMessage ()
86
86
dropped_message .email_from = line_match .group ("from" )
87
87
dropped_message .filename = line_match .group ("filename" )
@@ -102,9 +102,9 @@ def find_blocked_mail(blocked_mail, earliest_timestamp, f):
102
102
continue
103
103
user = match .group ("user" )
104
104
#user = email.split('@')[0]
105
- #print "user #" + user + "#"
105
+ #print( "user #" + user + "#")
106
106
if not re .match ("[A-Z0-9._%-]+" , user , re .IGNORECASE ):
107
- #print "Invalid user found in to list", user, ", skipping"
107
+ #print( "Invalid user found in to list", user, ", skipping")
108
108
continue
109
109
110
110
if not blocked_mail .has_key (user ):
@@ -128,7 +128,7 @@ def find_blocked_mail(blocked_mail, earliest_timestamp, f):
128
128
(options , args ) = parser .parse_args ()
129
129
130
130
if options .logfile_pattern == None :
131
- print "A logfile pattern must be specified"
131
+ print ( "A logfile pattern must be specified" )
132
132
parser .print_help ()
133
133
sys .exit ()
134
134
@@ -194,19 +194,19 @@ def find_blocked_mail(blocked_mail, earliest_timestamp, f):
194
194
msg ['To' ] = blocked_mail .email
195
195
196
196
if options .debug :
197
- print msg
197
+ print ( msg )
198
198
else :
199
199
try :
200
200
smtp .sendmail (options .contact , [blocked_mail .email ], msg .as_string ())
201
201
except :
202
- print "Error sending message to %s, will continue with next recipient" % (blocked_mail .email )
202
+ print ( "Error sending message to %s, will continue with next recipient" % (blocked_mail .email ) )
203
203
204
204
#summary msg = MIMEText(summary_mail_body)
205
205
#summary msg['Subject'] = 'Summary Digest of blocked email on mtu.net'
206
206
#summary msg['From'] = options.contact
207
207
#summary msg['To'] = options.contact
208
208
#summary if options.debug:
209
- #summary print msg
209
+ #summary print( msg)
210
210
#summary else:
211
211
#summary smtp.sendmail(options.contact, [options.contact], msg.as_string())
212
212
0 commit comments