SMTP Authentication

A

Achim Domma

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:

send: 'ehlo [10.0.0.35]\r\n'
reply: '250-essen115.server4free.de Hello p50837A3A.dip.t-dialin.net
[80.131.122
..58], pleased to meet you\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
[...]
reply: '250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5\r\n'
[...]
reply: retcode (250); Msg: essen115.server4free.de Hello
p50837A3A.dip.t-dialin.
net [80.131.122.58], pleased to meet you
[...]
AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5
[...]
send: 'AUTH CRAM-MD5\r\n'
reply: '334
PDM0NDE5NDYxMzAuMTA5MjcxNDFAZXNzZW4xMTUuc2VydmVyNGZyZWUuZGU+\r\n'
reply: retcode (334); Msg:
PDM0NDE5NDYxMzAuMTA5MjcxNDFAZXNzZW4xMTUuc2VydmVyNGZyZ
WUuZGU+
send: 'd2ViMXAxIDk1Yzk5ZDM3ZWI1MDMxZmI4YjFmNjJhNmY2MjUzMGYy\r\n'
reply: '535 5.7.0 authentication failed\r\n'
reply: retcode (535); Msg: 5.7.0 authentication failed
Traceback (most recent call last):
File "C:\scripts\wg_plan.py", line 41, in ?
server.login('my_login',pwd)
File "C:\Python23\lib\smtplib.py", line 583, in login
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, '5.7.0 authentication failed')

Can somebody give me a hint on how to encode the pwd? Or another way to send
mail, if the server requires authentication?

regards,
Achim
 
J

Jp Calderone

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

I know it says "imap4" in the URL, but Cram-MD5 authentication is the same
between several protocols, including SMTP.

Jp
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Jp said:
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
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Achim said:
It works fine, thanks a lot!

So there is a misconfiguration at the server end. You might want to
inform your ISP of this.

-- Gerhard
 
Joined
Jun 13, 2009
Messages
1
Reaction score
0
hi I use py 3.0 and i get a error in line 6 with say base64error should be a buffer or bythe no str. could you help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top