37,718
社区成员
发帖
与我相关
我的任务
分享
STATIC_URL = '/static/'
EMAIL_POST = 'smtp.126.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'mxbuqi@126.com'
EMAIL_HOST_PASSWORD = ' 密码'
EMAIL_SUBJECT_PREFTX = u''
EMAIL_USE_TLS = True
SERVER_EMAIL = '2229009552@qq.com'
def contact(request):
error = []
if request.method == 'POST':
if not request.POST.get('subject', ''):
error.append("please enter a subject")
if not request.POST.get('message',''):
error.append("please enter a message")
if request.POST.get('email') and "@" not in request.POST["email"]:
error.append("Please enter a valid e-mail")
if not error:
# send_mail(request.POST['subject'], request.POST['message'], request.POST.get('email', 'mxbuqi@126.com'), ['2229009552@qq.com'], fail_silently=True)
send_mail('subject', 'this is the message of email', 'mxbuqi@126.com', ['2229009552@qq.com'], fail_silently=True)
return HttpResponseRedirect('/contact/thanks/')
return render_to_response('contact.html', {'error' : error})
error at /contact/
[Errno 10061]
Request Method: POST
Request URL: http://127.0.0.1:8000/contact/
Django Version: 1.10
Exception Type: error
Exception Value:
[Errno 10061]
Exception Location: D:\Python\lib\socket.py in create_connection, line 571
Python Executable: D:\Python\python.exe
Python Version: 2.7.3
Python Path:
['C:\\Users\\miaoxu\\mysite',
'D:\\Python\\lib\\site-packages\\django-1.10-py2.7.egg',
'D:\\Python\\python27.zip',
'D:\\Python\\DLLs',
'D:\\Python\\lib',
'D:\\Python\\lib\\plat-win',
'D:\\Python\\lib\\lib-tk',
'D:\\Python',
'D:\\Python\\lib\\site-packages',
'D:\\Python\\lib\\site-packages\\PIL',
'D:\\Python\\lib\\site-packages\\win32',
'D:\\Python\\lib\\site-packages\\win32\\lib',
'D:\\Python\\lib\\site-packages\\Pythonwin']
Server time: 星期日, 11 九月 2016 23:35:09 +0000