smtplib "authentication required" error

Timothy Grant timothy.grant at gmail.com
Fri Mar 31 22:13:29 EST 2006


On 31 Mar 2006 18:20:27 -0800, carl.reimann at gmail.com
<carl.reimann at gmail.com> wrote:
> In using a simple smtp routine:
>
> # begin example
> >>> import smtplib
> >>> server = smtplib.SMTP('outgoing.verizon.net')
> >>> server.sendmail('my at address.net', 'another at address.net',
> """To: another at address.net
> From: my at address.net
> Subject: Shakespeare Quote
>
> Tis like the breath of an unfeed lawyer...
> """)
> >>> server.quit()
> # end example
>
> I find the following error:
>
>    raise SMTPSenderRefused(code, resp, from_addr)
> smtplib.SMTPSenderRefused: (550, '5.7.1 Authentication Required',
> 'myuserid at verizon.net')
>
>
> I have attempted to incorporate into the interactive session:
>
> server.login = ('userid', 'password')   # the same ones I use in my
> email program

I had some trouble with this not too long ago. I don't know what kind
of authentication your mail server requires, but to send through gmail
I had to do the following.

s = smtplib.SMTP('smtp.gmail.com')
s.set_debuglevel(1)
s.ehlo()
s.starttls()
s.ehlo()
s.login('foo', 'bar')
s.sendmail(from_address, to_addresses, msg)
s.close()

Hope that helps.

--
Stand Fast,
    tjg.



More information about the Python-list mailing list