mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
[html email] added html email for grp_add_member, notice, activate; improved subjects & content of all emails; use service_url
This commit is contained in:
@@ -7,7 +7,7 @@ from django.utils.http import int_to_base36
|
||||
from seahub.base.accounts import User
|
||||
from seahub.auth import authenticate
|
||||
from seahub.auth.tokens import default_token_generator
|
||||
from seahub.utils import IS_EMAIL_CONFIGURED
|
||||
from seahub.utils import IS_EMAIL_CONFIGURED, get_service_url
|
||||
|
||||
from captcha.fields import CaptchaField
|
||||
|
||||
@@ -92,24 +92,24 @@ class PasswordResetForm(forms.Form):
|
||||
if not domain_override:
|
||||
current_site = Site.objects.get_current()
|
||||
site_name = current_site.name
|
||||
domain = current_site.domain
|
||||
else:
|
||||
site_name = domain = domain_override
|
||||
site_name = domain_override
|
||||
|
||||
service_url = get_service_url()
|
||||
t = loader.get_template(email_template_name)
|
||||
|
||||
c = {
|
||||
'email': user.username,
|
||||
'domain': domain,
|
||||
'site_name': site_name,
|
||||
'uid': int_to_base36(user.id),
|
||||
'user': user,
|
||||
'token': token_generator.make_token(user),
|
||||
'protocol': use_https and 'https' or 'http',
|
||||
'service_url': service_url,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
}
|
||||
|
||||
msg = EmailMessage(_("Password reset on %s") % site_name,
|
||||
msg = EmailMessage(_("Reset Password on %s") % site_name,
|
||||
t.render(Context(c)), None, [user.username])
|
||||
msg.content_subtype = "html" # Main content is now text/html
|
||||
msg.send()
|
||||
|
@@ -1,9 +1,18 @@
|
||||
{% load url from future %}{% load i18n %}{% autoescape off %}
|
||||
{% blocktrans %}{{ email }} invite you to join group {{ group.group_name }}. Please go to the following page and sign up:{% endblocktrans %}
|
||||
{{ protocol }}://{{ domain }}{% url 'registration_register' %}?src={{ to_email }}
|
||||
{% extends 'email_base.html' %}
|
||||
|
||||
{% trans "Thanks for using our site!" %}
|
||||
{% load i18n seahub_tags %}
|
||||
|
||||
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
|
||||
{% block email_con %}
|
||||
{% autoescape off %}
|
||||
|
||||
<p style="color:#121214;font-size:14px;">{% trans "Hi, " %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans with grp_name=group.group_name %}{{ email }} invited you to join group {{ grp_name }} on {{ site_name }}: {% endblocktrans %}<br />
|
||||
{{ service_url }}{% url 'registration_register' %}?src={{ to_email }}
|
||||
</p>
|
||||
|
||||
{% endautoescape %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@@ -6,7 +6,7 @@ import simplejson as json
|
||||
import urllib2
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.mail import send_mail
|
||||
from django.core.mail import EmailMessage
|
||||
from django.core.paginator import EmptyPage, InvalidPage
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib import messages
|
||||
@@ -50,11 +50,11 @@ from seahub.wiki import get_group_wiki_repo, get_group_wiki_page, convert_wiki_l
|
||||
get_wiki_pages
|
||||
from seahub.wiki.models import WikiDoesNotExist, WikiPageMissing, GroupWiki
|
||||
from seahub.wiki.utils import clean_page_name, get_wiki_dirent
|
||||
from seahub.settings import SITE_ROOT, SITE_NAME, MEDIA_URL
|
||||
from seahub.settings import SITE_ROOT, SITE_NAME, MEDIA_URL, LOGO_PATH
|
||||
from seahub.shortcuts import get_first_object_or_none
|
||||
from seahub.utils import render_error, render_permission_error, string2list, \
|
||||
check_and_get_org_by_group, gen_file_get_url, get_file_type_and_ext, \
|
||||
calc_file_path_hash, is_valid_username
|
||||
calc_file_path_hash, is_valid_username, get_service_url
|
||||
from seahub.utils.file_types import IMAGE
|
||||
from seahub.utils.paginator import Paginator
|
||||
from seahub.views import is_registered_user
|
||||
@@ -640,21 +640,23 @@ def group_manage(request, group_id):
|
||||
continue
|
||||
|
||||
if not is_registered_user(email):
|
||||
use_https = request.is_secure()
|
||||
domain = RequestSite(request).domain
|
||||
service_url = get_service_url()
|
||||
t = loader.get_template('group/add_member_email.html')
|
||||
c = {
|
||||
'email': username,
|
||||
'to_email': email,
|
||||
'group': group,
|
||||
'domain': domain,
|
||||
'protocol': use_https and 'https' or 'http',
|
||||
'service_url': service_url,
|
||||
'site_name': SITE_NAME,
|
||||
'media_url': MEDIA_URL,
|
||||
'logo_path': LOGO_PATH,
|
||||
}
|
||||
try:
|
||||
send_mail(_(u'Your friend added you to a group at Seafile.'),
|
||||
t.render(Context(c)), None, [email],
|
||||
fail_silently=False)
|
||||
msg = EmailMessage(_(u'You are invited to join a group on %s.') % SITE_NAME,
|
||||
t.render(Context(c)), None, [email])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
|
||||
mail_sended_list.append(email)
|
||||
except Exception, e:
|
||||
logger.warn(e)
|
||||
|
@@ -3,44 +3,28 @@ import datetime
|
||||
import logging
|
||||
import string
|
||||
|
||||
from django.core.mail import send_mail
|
||||
from django.core.mail import EmailMessage
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from seahub.base.models import CommandsLastCheck
|
||||
from seahub.notifications.models import UserNotification
|
||||
from seahub.utils import get_service_url
|
||||
import seahub.settings as settings
|
||||
|
||||
from django.template import Context, loader
|
||||
|
||||
# Get an instance of a logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
email_templates = (u'''Hi, ${to_user}
|
||||
You've got ${count} new notice on ${site_name}.
|
||||
|
||||
Go check out at ${url}
|
||||
|
||||
Thanks for using our site!
|
||||
|
||||
${site_name} team
|
||||
''',
|
||||
u'''Hi, ${to_user}
|
||||
You've got ${count} new notices on ${site_name}.
|
||||
|
||||
Go check out at ${url}
|
||||
|
||||
Thanks for using our site!
|
||||
|
||||
${site_name} team
|
||||
''')
|
||||
|
||||
|
||||
|
||||
site_name = settings.SITE_NAME
|
||||
subjects = (u'New notice on %s' % site_name, u'New notices on %s' % site_name)
|
||||
url = settings.SITE_BASE.rstrip('/') + reverse('user_notification_list')
|
||||
service_url = get_service_url()
|
||||
media_url = settings.MEDIA_URL
|
||||
logo_path = settings.LOGO_PATH
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Send Email notifications to user if he/she has a unread notices every period of seconds .'
|
||||
help = 'Send Email notifications to user if he/she has an unread notices every period of seconds .'
|
||||
label = "notifications_send_notices"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
@@ -79,14 +63,22 @@ class Command(BaseCommand):
|
||||
|
||||
for to_user, count in email_ctx.items():
|
||||
subject = subjects[1] if count > 1 else subjects[0]
|
||||
template = string.Template(email_templates[1]) if count > 1 else \
|
||||
string.Template(email_templates[0])
|
||||
content = template.substitute(to_user=to_user, count=count,
|
||||
site_name=site_name, url=url)
|
||||
t = loader.get_template('notifications/notice_email.html')
|
||||
c = {
|
||||
'site_name': site_name,
|
||||
'media_url': media_url,
|
||||
'logo_path': logo_path,
|
||||
'service_url': service_url,
|
||||
'to_user': to_user,
|
||||
'notice_count': count,
|
||||
}
|
||||
|
||||
try:
|
||||
send_mail(subject, content, settings.DEFAULT_FROM_EMAIL,
|
||||
[to_user], fail_silently=False)
|
||||
msg = EmailMessage(subject, t.render(Context(c)), settings.DEFAULT_FROM_EMAIL,
|
||||
[to_user])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
logger.info('Successfully sent email to %s' % to_user)
|
||||
|
||||
except Exception, e:
|
||||
logger.error('Failed to send email to %s, error detail: %s' % (to_user, e))
|
||||
|
@@ -0,0 +1,24 @@
|
||||
{% extends 'email_base.html' %}
|
||||
|
||||
{% load i18n seahub_tags %}
|
||||
|
||||
{% block email_con %}
|
||||
{% autoescape off %}
|
||||
|
||||
<p style="color:#121214;font-size:14px;">{% blocktrans with name=to_user|email2nickname %}Hi {{ name }},{% endblocktrans %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans count num=notice_count %}
|
||||
You've got 1 new notice on {{ site_name }}.
|
||||
{% plural %}
|
||||
You've got {{num}} new notices on {{ site_name }}.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% trans "Go check out at the following page:" %}<br />
|
||||
{{ service_url }}{% url 'user_notification_list' %}
|
||||
</p>
|
||||
|
||||
{% endautoescape %}
|
||||
{% endblock %}
|
@@ -37,7 +37,7 @@ from seahub.views import validate_owner, is_registered_user
|
||||
from seahub.utils import render_permission_error, string2list, render_error, \
|
||||
gen_token, gen_shared_link, gen_shared_upload_link, gen_dir_share_link, \
|
||||
gen_file_share_link, IS_EMAIL_CONFIGURED, check_filename_with_rename, \
|
||||
get_repo_last_modify, is_valid_username
|
||||
get_repo_last_modify, is_valid_username, get_service_url
|
||||
|
||||
import seahub.settings as settings
|
||||
try:
|
||||
@@ -800,21 +800,19 @@ def send_shared_link(request):
|
||||
mail_sended.send(sender=None, user=request.user.username,
|
||||
email=to_email)
|
||||
|
||||
use_https = request.is_secure()
|
||||
domain = RequestSite(request).domain
|
||||
service_url = get_service_url()
|
||||
c = {
|
||||
'email': request.user.username,
|
||||
'to_email': to_email,
|
||||
'file_shared_link': file_shared_link,
|
||||
'site_name': SITE_NAME,
|
||||
'domain': domain,
|
||||
'protocol': use_https and 'https' or 'http',
|
||||
'service_url': service_url,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
}
|
||||
}
|
||||
|
||||
try:
|
||||
msg = EmailMessage(_(u'Your friend shared a file to you on Seafile'),
|
||||
msg = EmailMessage(_(u'A file is shared to you on s%') % SITE_NAME,
|
||||
t.render(Context(c)), None, [to_email])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
@@ -1081,22 +1079,19 @@ def send_shared_upload_link(request):
|
||||
mail_sended.send(sender=None, user=request.user.username,
|
||||
email=to_email)
|
||||
|
||||
|
||||
use_https = request.is_secure()
|
||||
domain = RequestSite(request).domain
|
||||
service_url = get_service_url()
|
||||
c = {
|
||||
'email': request.user.username,
|
||||
'to_email': to_email,
|
||||
'shared_upload_link': shared_upload_link,
|
||||
'site_name': SITE_NAME,
|
||||
'domain': domain,
|
||||
'protocol': use_https and 'https' or 'http',
|
||||
'service_url': service_url,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
}
|
||||
|
||||
try:
|
||||
msg = EmailMessage(_(u'Your friend shared a upload link to you on Seafile'),
|
||||
msg = EmailMessage(_(u'An upload link is shared to you on s%') % SITE_NAME,
|
||||
t.render(Context(c)), None, [to_email])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
<div style="background:#f2f2f2;padding:40px 0;">
|
||||
<div style="width:700px;background:#fff;border-style:solid;border-width:1px;border-color:#eaeaea #cccccc #a6a6a6;border-radius:4px;box-shadow:0 2px 2px #cdcdcd;margin:0 auto;">
|
||||
<img src="{{ protocol }}://{{domain}}{{media_url}}{{logo_path}}" alt="" style="display:block;margin:20px 0 15px 50px;" />
|
||||
<img src="{{ service_url }}{{media_url}}{{logo_path}}" alt="" style="display:block;margin:20px 0 15px 50px;" />
|
||||
<div style="padding:30px 55px 40px;min-height:300px;border-top:1px solid #efefef;box-shadow:inset 0 30px 30px #fcfcfc;">
|
||||
{% block email_con %}{% endblock %}
|
||||
|
||||
|
@@ -8,17 +8,13 @@
|
||||
|
||||
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">{% blocktrans %}You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}. {% endblocktrans %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% trans "Please go to the following page and choose a new password:" %}<br />
|
||||
{% block reset_link %}
|
||||
{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}
|
||||
{% endblock %}
|
||||
{% blocktrans with account=user.username %}To reset the password of your account {{ account }} on {{ site_name }}, please click the following link: {% endblocktrans %}<br />
|
||||
{{ service_url }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% trans "Your username, in case you've forgotten:" %} {{ user.username }}
|
||||
{% trans "If you did not request it, just skip it." %}<br />
|
||||
</p>
|
||||
|
||||
{% endautoescape %}
|
||||
|
@@ -9,11 +9,7 @@
|
||||
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans %}You're receiving this e-mail because {{ email }} is sharing a file to you on {{ site_name }}.{% endblocktrans%}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% trans "Please go to the following page and view the file:" %}<br />
|
||||
{% blocktrans %}{{ email }} shared a file to you on {{ site_name }}:{% endblocktrans%} <br />
|
||||
{{ file_shared_link }}
|
||||
</p>
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans %}You're receiving this e-mail because {{ email }} has shared an upload link to you on {{ site_name }}.{% endblocktrans%}
|
||||
{% blocktrans %}{{ email }} shared an upload link to you on {{ site_name }}.{% endblocktrans%}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
|
19
seahub/templates/sysadmin/user_activation_email.html
Normal file
19
seahub/templates/sysadmin/user_activation_email.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends 'email_base.html' %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block email_con %}
|
||||
|
||||
{% autoescape off %}
|
||||
|
||||
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans %}Your account {{ username }} on {{ site_name }} has been activated.{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<a href="{{ service_url }}{% url 'auth_login' %}" target="_blank">{% trans "Log In" %}</a>
|
||||
|
||||
{% endautoescape %}
|
||||
|
||||
{% endblock %}
|
@@ -1,10 +0,0 @@
|
||||
{% load i18n %}{% blocktrans %}You're receiving this e-mail because your account on {{site_name}} is activated by site admin.{% endblocktrans %}
|
||||
|
||||
{% trans "Please click the following link to log in:" %}
|
||||
{{login_url}}
|
||||
|
||||
{% trans "Your username, in case you've forgotten:" %} {{ username }}
|
||||
|
||||
{% trans "Thanks for using our site!" %}
|
||||
|
||||
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
|
@@ -1 +0,0 @@
|
||||
{% load i18n %}{% blocktrans %}Your account on {{site_name}} is activated{% endblocktrans %}
|
@@ -10,22 +10,19 @@
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% if org %}
|
||||
{% blocktrans with org_name=org.org_name %}You're receiving this e-mail because {{ user }} added you to organization "{{ org_name }}" on {{ site_name }}.{% endblocktrans%}
|
||||
{% blocktrans with org_name=org.org_name %}{{ user }} invited you to join organization "{{ org_name }}" on {{ site_name }}.{% endblocktrans%}
|
||||
{% else %}
|
||||
{% blocktrans %}You're receiving this e-mail because {{ user }} added you to {{ site_name }}.{% endblocktrans%}
|
||||
{% blocktrans %}{{ user }} invited you to join {{ site_name }}.{% endblocktrans%}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% trans "Following is your account information:" %}<br />
|
||||
{% trans "Here is your account information:" %}<br />
|
||||
{% blocktrans %}Email: {{ email }}{% endblocktrans %}<br />
|
||||
{% blocktrans %}Password: {{ password }}{% endblocktrans %}
|
||||
{% blocktrans %}Password: {{ password }}{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% trans "Please go to the following page and log in:" %}<br />
|
||||
{{ protocol }}://{{ domain }}{% url 'auth_login' %}
|
||||
</p>
|
||||
<a href="{{ service_url }}{% url 'auth_login' %}" target="_blank">{% trans "Log In" %}</a>
|
||||
|
||||
{% endautoescape %}
|
||||
|
||||
|
@@ -9,11 +9,7 @@
|
||||
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans %}You're receiving this e-mail because staff has reset your password at {{ site_name }}. {% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<p style="font-size:14px;color:#434144;">
|
||||
{% blocktrans %}Your new password is {{ password }}, please modify your password as soon as possible.{% endblocktrans %}
|
||||
{% blocktrans %}Your password on {{ site_name }} has been reset. Now it is {{ password }}. Please change it as soon as possible. {% endblocktrans %}
|
||||
</p>
|
||||
|
||||
{% endautoescape %}
|
||||
|
@@ -18,7 +18,6 @@ from urllib import quote
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.mail import send_mail
|
||||
from django.contrib import messages
|
||||
from django.contrib.sites.models import Site, RequestSite
|
||||
from django.db import IntegrityError
|
||||
|
@@ -33,7 +33,7 @@ from seahub.share.models import FileShare
|
||||
import seahub.settings as settings
|
||||
from seahub.settings import INIT_PASSWD, \
|
||||
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER, SEND_EMAIL_ON_RESETTING_USER_PASSWD
|
||||
from seahub.utils import get_site_scheme_and_netloc
|
||||
from seahub.utils import get_site_scheme_and_netloc, get_service_url
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -407,20 +407,21 @@ def user_deactivate(request, user_id):
|
||||
def email_user_on_activation(user):
|
||||
"""Send an email to user when admin activate his/her account.
|
||||
"""
|
||||
ctx_dict = {
|
||||
"site_name": settings.SITE_NAME,
|
||||
"login_url": "%s%s" % (get_site_scheme_and_netloc(),
|
||||
reverse('auth_login')),
|
||||
"username": user.email,
|
||||
service_url = get_service_url()
|
||||
site_name = settings.SITE_NAME
|
||||
|
||||
t = loader.get_template('sysadmin/user_activation_email.html')
|
||||
c = {
|
||||
'site_name': site_name,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
'service_url': service_url,
|
||||
'username': user.email,
|
||||
}
|
||||
subject = render_to_string('sysadmin/user_activation_email_subject.txt',
|
||||
ctx_dict)
|
||||
# Email subject *must not* contain newlines
|
||||
subject = ''.join(subject.splitlines())
|
||||
|
||||
message = render_to_string('sysadmin/user_activation_email.txt', ctx_dict)
|
||||
|
||||
user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
|
||||
msg = EmailMessage(_(u'Your account on s% is activated') % site_name, t.render(Context(c)),
|
||||
None, [user.email])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
|
||||
@login_required
|
||||
@sys_staff_required
|
||||
@@ -459,22 +460,19 @@ def send_user_reset_email(request, email, password):
|
||||
Send email when reset user password.
|
||||
"""
|
||||
|
||||
use_https = request.is_secure()
|
||||
domain = RequestSite(request).domain
|
||||
service_url = get_service_url()
|
||||
site_name = settings.SITE_NAME
|
||||
|
||||
t = loader.get_template('sysadmin/user_reset_email.html')
|
||||
c = {
|
||||
'email': email,
|
||||
'password': password,
|
||||
'site_name': settings.SITE_NAME,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
'domain': domain,
|
||||
'protocol': use_https and 'https' or 'http',
|
||||
'site_name': site_name,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
'service_url': service_url,
|
||||
}
|
||||
msg = EmailMessage(_(u'Password Reset'), t.render(Context(c)),
|
||||
msg = EmailMessage(_(u'Password has been reset on %s') % site_name, t.render(Context(c)),
|
||||
None, [email])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
@@ -519,22 +517,21 @@ def user_reset(request, user_id):
|
||||
def send_user_add_mail(request, email, password):
|
||||
"""Send email when add new user."""
|
||||
|
||||
use_https = request.is_secure()
|
||||
domain = RequestSite(request).domain
|
||||
|
||||
service_url = get_service_url()
|
||||
site_name = settings.SITE_NAME
|
||||
|
||||
t = loader.get_template('sysadmin/user_add_email.html')
|
||||
c = {
|
||||
'user': request.user.username,
|
||||
'org': request.user.org,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'domain': domain,
|
||||
'protocol': use_https and 'https' or 'http',
|
||||
'site_name': settings.SITE_NAME,
|
||||
'service_url': service_url,
|
||||
'site_name': site_name,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'logo_path': settings.LOGO_PATH,
|
||||
}
|
||||
msg = EmailMessage(_(u'Seafile Registration Information'), t.render(Context(c)),
|
||||
msg = EmailMessage(_(u'You are invited to join %s') % site_name, t.render(Context(c)),
|
||||
None, [email])
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
|
Reference in New Issue
Block a user