Commit 3009b420 authored by Julien Muchembled's avatar Julien Muchembled

registry: new SMTP options for authentication and starttls

parent 5e30be77
......@@ -79,10 +79,16 @@ def main():
_('--key', required=True,
help="CA private key in .pem format. For example:\nopenssl"
" genpkey -out ca.key -algorithm rsa -pkeyopt rsa_keygen_bits:2048")
_('--mailhost', default=None,
_('--mailhost',
help="SMTP host to send confirmation emails. For debugging"
" purpose, it can also be an absolute or existing path to"
" a mailbox file. If unset, registration by mail is disabled.")
_('--smtp-user',
help="SMTP login.")
_('--smtp-pwd',
help="SMTP password.")
_('--smtp-starttls', action='store_true',
help="Use STARTTLS for SMTP connections.")
_('--prefix-length', default=16, type=int,
help="Default length of allocated prefixes."
" If 0, registration by email is disabled.")
......
......@@ -353,6 +353,10 @@ class RegistryServer(object):
m.close()
else:
s = smtplib.SMTP(self.config.mailhost)
if self.config.smtp_starttls:
s.starttls()
if self.config.smtp_user:
s.login(self.config.smtp_user, self.config.smtp_pwd)
s.sendmail(self.email, email, msg.as_string())
s.quit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment