WebFaction
Community site: login faq

I'm trying to connect to the WebFaction SMTP server in python using smtplib, but I'm not having much luck.


My script:

from smtplib import SMTP

s = SMTP("smtp.webfaction.com")
try:
    s.set_debuglevel(True)
    s.ehlo()
finally:
    s.quit()

The error:

socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond


What am I doing wrong?

asked 13 Mar '11, 21:27

Acorn
382815
accept rate: 0%


The problem appears to be an incorrect initialization procedure. Can you try the example code outlined in the documentation, here?:

http://docs.webfaction.com/user-guide/email.html#sending-mail-from-an-application

permanent link

answered 13 Mar '11, 21:39

ryans ♦♦
5.0k93160
accept rate: 43%

I was having two problems:

  1. My isp most likely blocks port 25, so the connection wasn't getting through.

  2. When I tried using port 465 I needed to be using smtplib.SMTP_SSL.

The working code is:

from smtplib import SMTP_SSL

s = SMTP_SSL("smtp.webfaction.com", 465)
try:
    s.set_debuglevel(True)
    s.ehlo()
finally:
    s.quit()
permanent link

answered 13 Mar '11, 21:41

Acorn
382815
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×41
×3

question asked: 13 Mar '11, 21:27

question was seen: 15,404 times

last updated: 13 Mar '11, 21:41

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM