Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   "smtplib.SMTPServerDisconnected: please run connect() first" (http://www.velocityreviews.com/forums/t701036-smtplib-smtpserverdisconnected-please-run-connect-first.html)

kj 10-09-2009 10:38 PM

"smtplib.SMTPServerDisconnected: please run connect() first"
 


I'm getting the error:

smtplib.SMTPServerDisconnected: please run connect() first

when I run code that is essentially identical to the code given in

http://docs.python.org/library/email-examples.html

The error happens at the line (copied verbatim from the example
linked to above):

s.sendmail(me, [you], msg.as_string())

What am I doing wrong?

kynn

P.S. I'm running this using v. 2.6.1.

P.S.2. By "essentially identical" I mean that the only change I
made to the original snippet was to initialize variables that are
not initialized in the original (namely, textfile, me, and you)

Ethan Furman 10-09-2009 11:02 PM

Re: "smtplib.SMTPServerDisconnected: please run connect() first"
 
kj wrote:
>
> I'm getting the error:
>
> smtplib.SMTPServerDisconnected: please run connect() first
>
> when I run code that is essentially identical to the code given in
>
> http://docs.python.org/library/email-examples.html
>
> The error happens at the line (copied verbatim from the example
> linked to above):
>
> s.sendmail(me, [you], msg.as_string())
>
> What am I doing wrong?
>
> kynn
>
> P.S. I'm running this using v. 2.6.1.
>
> P.S.2. By "essentially identical" I mean that the only change I
> made to the original snippet was to initialize variables that are
> not initialized in the original (namely, textfile, me, and you)


The line preceeding it,

s = smtplib.SMTP()

needs to have an e-mail server specified. E.g.

s = smtplib.SMTP('localhost') # from the 2.5 docs


Hope this helps!

~Ethan~

kj 10-10-2009 01:35 AM

Re: "smtplib.SMTPServerDisconnected: please run connect() first"
 
In <mailman.1096.1255129309.2807.python-list@python.org> Ethan Furman <ethan@stoneleaf.us> writes:

>The line preceeding it,


>s = smtplib.SMTP()


>needs to have an e-mail server specified. E.g.


>s = smtplib.SMTP('localhost') # from the 2.5 docs


Perfect. Thanks!

kynn


All times are GMT. The time now is 08:04 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57