1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-13 13:50:07 +00:00

[language] send email

This commit is contained in:
zming
2017-06-12 16:45:09 +08:00
parent 14df2bcffd
commit c83cc9f212
2 changed files with 9 additions and 2 deletions

View File

@@ -394,6 +394,9 @@ ACTIVATE_AFTER_REGISTRATION = True
# This option will be ignored if ``ACTIVATE_AFTER_REGISTRATION`` set to ``True``.
REGISTRATION_SEND_MAIL = False
#Control the language that send email.
SHARE_LINK_EMAIL_LANGUAGE = ''
REQUIRE_DETAIL_ON_REGISTRATION = False
# Account initial password, for password resetting.

View File

@@ -9,7 +9,7 @@ from constance import config
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseRedirect, Http404, \
HttpResponseBadRequest
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext as _, activate, deactivate
from django.contrib import messages
from django.utils import timezone
from django.utils.html import escape
@@ -31,7 +31,8 @@ from seahub.utils import string2list, gen_shared_link, \
is_valid_username, is_valid_email, send_html_email, is_org_context, \
gen_token, normalize_cache_key
from seahub.utils.mail import send_html_email_with_dj_template, MAIL_PRIORITY
from seahub.settings import SITE_ROOT, REPLACE_FROM_EMAIL, ADD_REPLY_TO_HEADER
from seahub.settings import SITE_ROOT, REPLACE_FROM_EMAIL, \
ADD_REPLY_TO_HEADER, SHARE_LINK_EMAIL_LANGUAGE
from seahub.profile.models import Profile
# Get an instance of a logger
@@ -149,6 +150,8 @@ def send_shared_link(request):
send_failed.append(to_email)
continue
if SHARE_LINK_EMAIL_LANGUAGE:
activate(SHARE_LINK_EMAIL_LANGUAGE)
# Add email to contacts.
mail_sended.send(sender=None, user=request.user.username,
email=to_email)
@@ -192,6 +195,7 @@ def send_shared_link(request):
except Exception:
send_failed.append(to_email)
deactivate()
if len(send_success) > 0:
data = json.dumps({"send_success": send_success, "send_failed": send_failed})
return HttpResponse(data, status=200, content_type=content_type)