sending emails using python

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Thu Sep 7 06:54:41 EDT 2006


Steve Holden enlightened us with:
> This is untrue for the Python smtplib, though correct according to
> the RFCs. The SMTP.data() method uses a locally-declared function
> called quotedata() to ensure the correct line endings, so using "\n"
> will result in the same message as using "\r\n".

Ah, wonderful.

> Useless it might be, but it's a lot more clueful than some questions
> we see, so it seems a little dismissive just to say "it's useless" -
> the OP has provided the traceback, which is so often missing in
> questions from newbies, and has correctly localized the error to a
> small chunk of code.

I agree with you. My remark might indeed have sounded harsher than
intended. It referred to the traceback itself, not the posting of the
traceback. That was rather useful.

> Ethereal trace will provide little more data than the traceback.

I don't know until I see it. Perhaps the socket is closed in response
to something the client sends. That can be seen in the Ethereal trace.

> I suppose it'll tell you whether the server is sending RST or FIN to
> terminate the connection, but it won't give much insight into why.

A quick peek in the SMTP logfiles should tell you that.

> Perhaps the SMTP server is strapped down to accepting connections from 
> specific IP addresses by some firewall?

In that case I'd expect the SMTP server to simply ignore the
connection attempt and cause a timeout in the connecting phase. I
wouldn't expect a connection to be created and then closed again,
which is what I read in the posted traceback.

> It would probably be a good idea to have a chat with the server's
> administrator to see if they can suggest what might be going wrong.

Good idea indeed. Another idea would be to use something like netcat
or telnet to connect to the port and see what happens if you manually
type an SMTP connection.

Sybren
-- 
Sybren Stüvel
Stüvel IT - http://www.stuvel.eu/



More information about the Python-list mailing list