From 0667067c0c4a77930ac5ac93b8521899ed82c33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B3=BD?= Date: Tue, 13 Oct 2015 16:36:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=95=E8=8E=B7=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=82=AE=E7=AE=B1=E5=A1=AB=E5=86=99=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=B6=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juser/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/juser/views.py b/juser/views.py index 76e92cdfb..29f86caaa 100644 --- a/juser/views.py +++ b/juser/views.py @@ -663,8 +663,11 @@ def user_add(request): except Exception: pass else: - send_mail(mail_title, mail_msg, MAIL_FROM, [email], fail_silently=False) - msg = u'添加用户 %s 成功! 用户密码已发送到 %s 邮箱!' % (username, email) + try: + send_mail(mail_title, mail_msg, MAIL_FROM, [email], fail_silently=False) + msg = u'添加用户 %s 成功! 用户密码已发送到 %s 邮箱!' % (username, email) + except: + msg = u'添加用户 %s 成功! 用户密码发送失败,请检查邮箱是否正确!' % username return render_to_response('juser/user_add.html', locals(), context_instance=RequestContext(request))