WebFaction
Community site: login faq

So I have the following email settings specified:

EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = 'mailbox_name'
EMAIL_HOST_PASSWORD = 'mailbox_password'
DEFAULT_FROM_EMAIL = 'Default email address'

These work just fine when deployed on Webfaction but won't work locally. The server just hangs. What could be causing this?

asked 11 Mar '12, 12:15

aa56280
131714
accept rate: 0%

edited 11 Mar '12, 12:50

It would be difficult to troubleshoot why it's not working localy, as we are not familiar with your local setup, but you should verify that smtp.webfaction.com resolves to the correct IP address 74.55.86.74 and that the first line is not a typo. The variable should be EMAIL_HOST.

Are you able to use another mail server, like a gmail one, successfully? If you could update your question with more info, like any possible errors or exceptions, we'd appreciate it.

You can find more about sending email with Django here and here.

(11 Mar '12, 12:28) iliasr ♦♦

@iliasr: That was a typo. The variable is EMAIL_HOST in the file. I'll make the edit. And yes, smtp.webfaction.com does resolve to 74.55.86.74.

I haven't tried Gmail. I've used the same setup for sending emails on other projects I've hosted on Webfaction in the past. For some reason, it's not working anymore.

(11 Mar '12, 12:50) aa56280

Can you connect to smtp.webfaction.com via telnet?

You may need to specify the port, telnet smtp.webfaction.com 25

Try specifying the port in your settings.py as well. EMAIL_PORT = 25

(11 Mar '12, 13:19) bmeyer71 ♦♦

telnet smtp.webfaction.com: Trying 74.55.86.74... telnet: connect to address 74.55.86.74: Connection refused telnet: Unable to connect to remote host

telnet smtp.webfaction.com 25 Trying 74.55.86.74...

It just hangs at "Trying..." when I specify the port for a while but then eventually comes back with the same results.

(11 Mar '12, 13:51) aa56280

Sounds like the port is being blocked by a firewall possibly. You should be able to connect via telnet as I have specified. If you can check this and reply back with any further information.

(11 Mar '12, 14:00) bmeyer71 ♦♦

Just checked. Nothing is being blocked from what I can tell.

(11 Mar '12, 14:04) aa56280

Something is blocking your access. Using telnet to the server on port 25 should work. I've confirmed it from my location.

(11 Mar '12, 14:26) bmeyer71 ♦♦
showing 5 of 7 show 2 more comments

I'm not sure why, but I was able to get around this issue by using smtplib.SMTP_SSL:

smtp = smtplib.SMTP_SSL()
smtp.connect(settings.EMAIL_HOST)
smtp.login(settings.EMAIL_HOST_USER, settings.EMAIL_HOST_PASSWORD)
smtp.sendmail(send_from, to, msg.as_string())
smtp.close()
permanent link

answered 13 Dec '12, 18:11

Josh
2624
accept rate: 0%

Hello,

Sometimes ISPs block outgoing connections on port 25, as an antispam measure. Ergo one needs to use authenticated SMTP on port 465, as per our documentation, to work around the problem - like Josh did.

Sincerely,

Valentin I.
WebFaction Support
--
WebFaction - Smarter web hosting
http://webfaction.com
http://twitter.com/webfaction - http://facebook.com/webfaction

permanent link

answered 28 Feb '14, 10:35

valentini
2614
accept rate: 28%

edited 28 Feb '14, 10:37

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:

×909
×10

question asked: 11 Mar '12, 12:15

question was seen: 2,740 times

last updated: 28 Feb '14, 10:37

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