From b4b88206fec63d5e935b68b51521fa54e4b598c7 Mon Sep 17 00:00:00 2001 From: Atanas Zhelev Date: Feb 12 2020 13:38:18 +0000 Subject: Add smtp authentication support --- diff --git a/builder/kojid b/builder/kojid index 4fdfb7a..dc0faba 100755 --- a/builder/kojid +++ b/builder/kojid @@ -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 ', 'krb_principal': None, 'host_principal_format': 'compile/%s@EXAMPLE.COM', diff --git a/builder/kojid.conf b/builder/kojid.conf index 4b56c96..394d328 100644 --- a/builder/kojid.conf +++ b/builder/kojid.conf @@ -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