Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

smtplib "authentication required" error

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


carl.reimann at gmail

Mar 31, 2006, 6:20 PM

Post #1 of 4 (2844 views)
Permalink
smtplib "authentication required" error

In using a simple smtp routine:

# begin example
>>> import smtplib
>>> server = smtplib.SMTP('outgoing.verizon.net')
>>> server.sendmail('my [at] address', 'another [at] address',
"""To: another [at] address
From: my [at] address
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')


I have attempted to incorporate into the interactive session:

server.login = ('userid', 'password') # the same ones I use in my
email program

But I get the same error result. My objective is to have a simple way
to send email from the command line. To do this I will write a script
which can read in a file and send it to the address on top of the file.
What is the procedure for authentication?

Using the KMail email program (Linux, KDE desktop), I send mail through
my Verizon account. Under the Configure KMail / Accounts / Modify
Account / Extras tab, I clicked "Check what the server supports" and it
came back 'no encryption' and 'cleartext'. So it doesn't seem that it
would involve complex procedures.

Any help welcome.

--
http://mail.python.org/mailman/listinfo/python-list


timothy.grant at gmail

Mar 31, 2006, 7:13 PM

Post #2 of 4 (2832 views)
Permalink
Re: smtplib "authentication required" error [In reply to]

On 31 Mar 2006 18:20:27 -0800, carl.reimann [at] gmail
<carl.reimann [at] gmail> wrote:
> In using a simple smtp routine:
>
> # begin example
> >>> import smtplib
> >>> server = smtplib.SMTP('outgoing.verizon.net')
> >>> server.sendmail('my [at] address', 'another [at] address',
> """To: another [at] address
> From: my [at] address
> 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')
>
>
> 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.
--
http://mail.python.org/mailman/listinfo/python-list


carl.reimann at gmail

Apr 1, 2006, 8:56 AM

Post #3 of 4 (2820 views)
Permalink
Re: smtplib "authentication required" error [In reply to]

Dear tjg: That was extremely helpful. Thank you very kindly. The server
did not respond to the .starttls() method but authentication was
successful after, it seems, the .ehlo() was specified. I have tried the
script without the first s.ehlo() and without s.starttls() and it works
perfectly. My authentication problems seem to have been that the server
uses EHLO, which must be specified! Thank you very kindly.

--
http://mail.python.org/mailman/listinfo/python-list


bbxx789_05ss at yahoo

May 17, 2008, 6:58 PM

Post #4 of 4 (2798 views)
Permalink
Re: smtplib "authentication required" error [In reply to]

On May 17, 12:18 pm, cher <cheryl.gi...@comcast.net> wrote:
> Hey,
>
> Don't know if you can help, but I'm trying to import archived messages
> from Thunderbird into my gmail account and keep getting these types of
> errors.  I am using the GML program to help incorporate, but the SMTP
> server is not being recognized by gmail.  Am I doing something wrong?  
> Anything else I can try?
> SMTP I've tried:
>     smtp.gmail.com
>     gsmtp56.google.com
>
> Error Val : (530, '5.7.0 Must issue a STARTTLS command first.
> m29sm9416768poh.4',
> *** 76 ERROR SENDING MESSAGE FROM: r...@bassisloadeddj.com
> *** UNABLE TO CONNECT TO SERVER OR SEND MESSAGE. ERROR FOLLOWS.
> Error Type: smtplib.SMTPSenderRefused
> Error Val : (530, '5.7.0 Must issue a STARTTLS command first.
> n22sm9448670pof.3', 'r...@bassisloadeddj.com')
>
> Thanks,
> Cher

Can you get the following program to work?


#Uses gmail to send an email to someone

import smtplib

sender = "Tom"
to = "Sally"
subject = "Test smtplib"

headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (sender, to,
subject)
msg = headers + "Hello. How are you?"

mailserver = smtplib.SMTP("smtp.gmail.com", 587)
mailserver.ehlo()
mailserver.starttls()
mailserver.ehlo()
mailserver.login("your_gmail_email_address", "your_gmail_password")
mailserver.sendmail("your_gmail_email_addres",
"a_destination_email_address", msg)
mailserver.close()

--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.