diff -r 89b738e3d0c9 Lib/poplib.py --- a/Lib/poplib.py Thu Jan 23 09:49:42 2014 +0200 +++ b/Lib/poplib.py Thu Jan 23 10:58:13 2014 +0100 @@ -71,6 +71,7 @@ UIDL [msg] uidl(msg = None) CAPA capa() STLS stls() + AUTH auth(mech, secret = None) Raises one exception: 'error_proto'. @@ -394,6 +395,22 @@ self._tls_established = True return resp + def auth(self, mech, secret=None): + """ + SASL Authentication. + + Supported if capa() returns a SASL tag (e.g. SASL PLAIN). + + Args: + mech - authentication mechanism + secret - authentication secret + """ + if secret is None: + resp = self._longcmd('AUTH %s' % mech) + else: + resp = self._shortcmd('AUTH %s %s' % (mech, secret)) + return resp + if HAVE_SSL: