summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/mailer.py
diff options
context:
space:
mode:
Diffstat (limited to 'source-builder/sb/mailer.py')
-rw-r--r--source-builder/sb/mailer.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/source-builder/sb/mailer.py b/source-builder/sb/mailer.py
index b6f686c..b9ef812 100644
--- a/source-builder/sb/mailer.py
+++ b/source-builder/sb/mailer.py
@@ -21,6 +21,8 @@
# Manage emailing results or reports.
#
+from __future__ import print_function
+
import os
import smtplib
import socket
@@ -64,7 +66,7 @@ class mail:
mrc = open(mailrc, 'r')
lines = mrc.readlines()
mrc.close()
- except IOError, err:
+ except IOError as err:
raise error.general('error reading: %s' % (mailrc))
for l in lines:
l = _clean(l)
@@ -93,9 +95,9 @@ class mail:
try:
s = smtplib.SMTP(self.smtp_host())
s.sendmail(from_addr, [to_addr], msg)
- except smtplib.SMTPException, se:
+ except smtplib.SMTPException as se:
raise error.general('sending mail: %s' % (str(se)))
- except socket.error, se:
+ except socket.error as se:
raise error.general('sending mail: %s' % (str(se)))
if __name__ == '__main__':
@@ -104,6 +106,6 @@ if __name__ == '__main__':
append_options(optargs)
opts = options.load(sys.argv, optargs = optargs, defaults = 'defaults.mc')
m = mail(opts)
- print 'From: %s' % (m.from_address())
- print 'SMTP Host: %s' % (m.smtp_host())
+ print('From: %s' % (m.from_address()))
+ print('SMTP Host: %s' % (m.smtp_host()))
m.send(m.from_address(), 'Test mailer.py', 'This is a test')