+def email_success():
+ '''send an email to options.email about a successful build'''
+ user = os.getenv("USER")
+ text = '''
+Dear Developer,
+
+Your autobuild has succeeded.
+
+'''
+
+ if options.keeplogs:
+ text += '''
+
+you can get full logs of all tasks in this job here:
+
+ http://git.samba.org/%s/samba-autobuild/logs.tar.gz
+
+''' % (user,)
+ msg = MIMEText(text)
+ msg['Subject'] = 'autobuild success'
+ msg['From'] = 'autobuild@samba.org'
+ msg['To'] = options.email
+
+ s = smtplib.SMTP()
+ s.connect()
+ s.sendmail(msg['From'], [msg['To']], msg.as_string())
+ s.quit()
+
+