Add smtp authentication support

This commit is contained in:
Atanas Zhelev 2017-11-09 17:24:40 +02:00 committed by Tomas Kopecek
parent c3cfe3833a
commit b4b88206fe
2 changed files with 10 additions and 0 deletions

View file

@ -4938,6 +4938,8 @@ Status: %(status)s\r
if six.PY3:
message = message.encode('utf8')
server = smtplib.SMTP(self.options.smtphost)
if self.options.smtp_user is not None and self.options.smtp_pass is not None:
server.login(self.options.smtp_user, self.options.smtp_pass)
#server.set_debuglevel(True)
server.sendmail(from_addr, recipients, message)
@ -5150,6 +5152,8 @@ Build Info: %(weburl)s/buildinfo?buildID=%(build_id)i\r
if six.PY3:
message = message.encode('utf8')
server = smtplib.SMTP(self.options.smtphost)
if self.options.smtp_user is not None and self.options.smtp_pass is not None:
server.login(self.options.smtp_user, self.options.smtp_pass)
# server.set_debuglevel(True)
server.sendmail(from_addr, recipients, message)
server.quit()
@ -6184,6 +6188,8 @@ def get_options():
'distribution': 'Koji',
'mockhost': 'koji-linux-gnu',
'smtphost': 'example.com',
'smtp_user': None,
'smtp_pass': None,
'from_addr': 'Koji Build System <buildsys@example.com>',
'krb_principal': None,
'host_principal_format': 'compile/%s@EXAMPLE.COM',

View file

@ -86,6 +86,10 @@ allowed_scms=scm.example.com:/cvs/example git.example.org:/example svn.example.o
; The mail host to use for sending email notifications
smtphost=example.com
; SMTP user and pass (uncomment and fill in if your smtp server requires authentication)
;smtp_user=user@example.com
;smtp_pass=CHANGEME
; The From address used when sending email notifications
from_addr=Koji Build System <buildsys@example.com>