English 中文(简体)
Connection timeout issue sending email in Django
原标题:

I read from

http://www.packtpub.com/article/friends-via-email-social-web-application-django-1.0

and follow the steps: => And change my setting.py

SITE_HOST =  127.0.0.1:8000 
DEFAULT_FROM_EMAIL =  KSO Publisher <soeng@xxxx.com.kh> 
EMAIL_HOST =  smtp.xxxx.com.kh 
EMAIL_PORT =  25 
EMAIL_HOST_USER =  myusernamea@xxxx.com.kh 
EMAIL_HOST_PASSWORD =  mypassword 
EMAIL_USE_TLS = False

after I go to the command line

python@python-desktop:~/workspace/kso$ python manage.py shell
Python 2.5.2 (r252:60911, Jul 22 2009, 15:35:03) 
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.mail import send_mail
>>> emails = send_mail( Subject ,  Body of the message. , soeng@xxxx.com.kh ,[ pythonkhmer@gmail.com ])

I got the error message.

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/var/lib/python-support/python2.5/django/core/mail.py", line 345, in send_mail
    connection=connection).send()
  File "/var/lib/python-support/python2.5/django/core/mail.py", line 271, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/var/lib/python-support/python2.5/django/core/mail.py", line 166, in send_messages
    new_conn_created = self.open()
  File "/var/lib/python-support/python2.5/django/core/mail.py", line 131, in open
    local_hostname=DNS_NAME.get_fqdn())
  File "/usr/lib/python2.5/smtplib.py", line 244, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.5/smtplib.py", line 310, in connect
    raise socket.error, msg
error: (110,  Connection timed out )

Anybody know what exactly the problem.And how Can I sent mail using django framworks

Reference I have read:

最佳回答

Connection timed out means Django couldn t connect to your email server. Type this on a command line:

telnet smtp.xxxx.com.kh 25

You should get a response from the email server, something like:

220 rufus Python SMTP proxy version 0.2

If you don t get a response,you have found the problem.

Here s a handy command to run a local development server, on Linux:

sudo /usr/lib/python2.6/smtpd.py -n -c DebuggingServer 127.0.0.1:25
问题回答

You code looks correct, so I think there is a problem with your settings. Are you positive that specified the EMAIL_HOST and EMAIL_PORT correctly?

Note: Its EMAIL_USE_TLS not MAIL_USE_TLS and you can set your from address (3rd parameter in send_mail function) to None if you want it to take your DEFAULT_FROM_EMAIL value.





相关问题
Angle brackets in php

I want to store angle brackets in a string in PHP because i want to eventually use mail() to send an HTML email out. The following is the code that doesn t seem to work. while(...) { $msg .= "<...

authlogic auto_register feature using my options

I have auto registration working with authlogic using gaizka s version of authlogic_openid which I found on Github since pelle s original addition of the feature seemed to cause issues. http://...

Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

How to track an email in Java?

How I can track an email? I m using java on the server side for sending emails. I want to track whether it is delivered , opened, etc... How I can do that ?

Web Link in a mail is not rendering as link in yahoo

string from = "abc@gmail.com"; string to = "xyz@gmail.com,xyz@yahoo.co.in"; string password="abcxyz"; MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(to); mail.From = new ...

SharePoint - Approaching Website Storage Limit Email

How can i go about changing the distribution list as well as the email text for the email that goes out to site collection admin when a site collection approaches it s size limit? Thanks for your ...

How to create an email mailing list

Im creating a coming soon page for a website im developing, and im adding an option for the user to enter their email address so we can email them when the site is up. How do I do this?

CCNet email does not include MSBuild results

We re using CCNet 1.4.4.83 but when an MSBuild task fails, we don t get the MSBuild results (i.e. missing file or whatever reason the compile failed) in the email notification. I do see the build ...

热门标签