mercurial/mail.py
changeset 43172 9145abd8b96d
parent 43171 54b06bec8914
child 43324 866bd2cf764b
equal deleted inserted replaced
43171:54b06bec8914 43172:9145abd8b96d
   143     if starttls or smtps:
   143     if starttls or smtps:
   144         ui.note(_(b'(verifying remote certificate)\n'))
   144         ui.note(_(b'(verifying remote certificate)\n'))
   145         sslutil.validatesocket(s.sock)
   145         sslutil.validatesocket(s.sock)
   146     username = ui.config(b'smtp', b'username')
   146     username = ui.config(b'smtp', b'username')
   147     password = ui.config(b'smtp', b'password')
   147     password = ui.config(b'smtp', b'password')
   148     if username and not password:
   148     if username:
   149         password = ui.getpass()
   149         if password:
       
   150             password = encoding.strfromlocal(password)
       
   151         else:
       
   152             password = ui.getpass()
   150     if username and password:
   153     if username and password:
   151         ui.note(_(b'(authenticating to mail server as %s)\n') % username)
   154         ui.note(_(b'(authenticating to mail server as %s)\n') % username)
       
   155         username = encoding.strfromlocal(username)
   152         try:
   156         try:
   153             s.login(username, password)
   157             s.login(username, password)
   154         except smtplib.SMTPException as inst:
   158         except smtplib.SMTPException as inst:
   155             raise error.Abort(inst)
   159             raise error.Abort(inst)
   156 
   160