我已经使用10061服务器了。我的代码就像,
setting.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
views.py:
def trying(request):
message = request.POST.get('message', '')
if message:
try:
send_mail("Testing", message, "s.tanna1992@gmail.com",['s.tanna1992@gmail.com'])
except BadHeaderError:
return HttpResponse('Invalid header found.')
return HttpResponse('Send Successfully...1')
else:
# In reality we'd use a form class
# to get proper validation errors.
return HttpResponse('Make sure all fields are entered and valid.')
没有防火墙我应该配置哪个设置?是否需要定义端口?如果是,那么我应该在哪里定义?
答案 0 :(得分:0)
在settings.py
文件中,您是否还要定义EMAIL_HOST
,EMAIL_PORT
等内容?
See the Django documentation了解您可以使用的各种设置。