SMTP Authentication

Gerhard Häring gh at ghaering.de
Tue Nov 4 21:29:36 EST 2003


Jp Calderone wrote:
> On Mon, Nov 03, 2003 at 09:41:37PM +0100, Achim Domma wrote:
> 
>>Hi,
>>
>>I try to authenticate via script to my mail server. I found some hints via
>>google, that SMTP authentication is a problem, but no solution. Using
>>set_debuglevel(1), I can see something like that:
>>
>>[snip transcript]
>>
>>Can somebody give me a hint on how to encode the pwd? Or another way to send
>>mail, if the server requires authentication?
> 
> 
>     http://twistedmatrix.com/documents/api/twisted.protocols.imap4.CramMD5ClientAuthenticator.html
> 
> [...]

Aha. Twisted is the solution for everything, right? </sarcasm>

SMTP.login() should work perfectly ok. I'd need a transcript *and* the 
real username and password to debug this, though. But chances are that 
the problem is at the SMPT *server* end, not the client end.

You could try to force the PLAIN login method instead of the CRAM-MD5 
authentification method, by doing something like:

import smtplib
s = smtplib.SMTP("mylene.ghaering.de")
s.ehlo()
s.esmtp_features["auth"] = "LOGIN PLAIN"
s.debuglevel = 5
s.login("myusername", "mypassword")

Let me know if this helps.

-- Gerhard






More information about the Python-list mailing list