2010-06-10 303 views
1

干草,我似乎无法使用send_mail()发送电子邮件,我不知道为什么。django发送电子邮件

这里是我的细节

settins.py

EMAIL_HOST = 'localhost', 
EMAIL_PORT = 25 

我的观点

from django.core.mail import send_mail 

send_mail('Subject here', 'Here is the message.', '[email protected]', 
    ['[email protected]'], fail_silently=False) 

这失败,出现错误

getaddrinfo() argument 1 must be string or None 

任何人有任何想法?

我开发的OS X Leopard的

继承人的最后追踪

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtplib.py in connect 
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): ... 
▼ Local vars 
Variable Value 
host ('localhost',) 
msg  'getaddrinfo returns an empty list' 
port 25 
self <smtplib.SMTP instance at 0x153b1e8> 

回答

7

EMAIL_HOST逗号后是使它长一个,而不是字符串的元组。删除流浪的逗号。

+0

就这样我的问题解决了!非常感谢你! – dotty 2010-06-10 11:12:25