Using smtplib login with esmtp

Daniel Fackrell unlearned at DELETETHIS.learn2think.org
Thu Aug 1 20:12:25 CEST 2002


"Samir Patel" <mepython at yahoo.com> wrote in message
news:mailman.1028222171.23705.python-list at python.org...
> I am trying to  send login request with smtplib using
> login methond of SMTP, it returns with following
> error:
> "smtplib.SMTPException: No suitable authentication
> method found."
>
> I think this is happening because it is using esmtp.
> this is what esmtp_features returns:
> {'8bitmime': '', 'auth': '=LOGIN', 'size': ''}
>
> Can somebody tells me what I need to change to use
> esmtp login?
>
> Here is my code:
>
> from smtplib import SMTP
> s = SMTP('smtpserver.com")
> s.login('username Here', 'Password here')
>
> What I need to do to this last line in order to use
> above esmtp?


Just as a shot in the dark, as I've only used smtplib once or twice, but
have you tried without the 's.login()' line?  Most SMTP servers do not
require a login, and trying to log in to a server that does not require it
might lead to exactly that sort of error.  It seems I might have even seen
this error for that reason, but I don't exactly recall.

Trying this code pointed to a system here that's running sendmail and does
not require a login, I get (Python 2.2, Windows 2000):

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python22\lib\smtplib.py", line 513, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
smtplib.SMTPException: SMTP AUTH extension not supported by server.

which is different, so maybe it's not related to your issue, but who knows?

--
Daniel Fackrell (unlearned at learn2think.org)
When we attempt the impossible, we can experience true growth.





More information about the Python-list mailing list