- for bug in bc.unclassified_bugs():
- controls += bc.classify_bug(bug)
-
- if controls:
- return 'user ftp.debian.org@packages.debian.org\n' + controls
-
-import smtplib
-import email.Message
-
-def send_email(body):
- to = 'control@bugs.debian.org'
- sender = 'ak@ries.debian.org'
- message = email.Message.Message()
- message["To"] = to
- message["From"] = sender
- message.set_payload(body)
- mailServer = smtplib.SMTP('localhost')
- mailServer.sendmail(sender, to, message.as_string())
- mailServer.quit()
+ try:
+ for bug in bc.unclassified_bugs():
+ controls += bc.classify_bug(bug)
+
+ return controls
+ except:
+ log.error("couldn't retrieve bugs from soap interface: %s" % sys.exc_info()[0])
+ return None
+
+def send_email(commands, simulate=False):
+ global Cnf
+
+ Subst = {'__COMMANDS__' : commands,
+ "__DAK_ADDRESS__": Cnf["Dinstall::MyAdminAddress"]}
+
+ bts_mail_message = utils.TemplateSubst(
+ Subst,Cnf["Dir::Templates"]+"/bts-categorize")
+
+ if simulate:
+ print bts_mail_message
+ else:
+ utils.send_mail( bts_mail_message )