1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 03:47:09 +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:
llj
2014-02-18 20:16:39 +08:00
parent 9f67f09ee5
commit 69da4a3d51
17 changed files with 143 additions and 132 deletions

View File

@@ -7,7 +7,7 @@ from django.utils.http import int_to_base36
from seahub.base.accounts import User from seahub.base.accounts import User
from seahub.auth import authenticate from seahub.auth import authenticate
from seahub.auth.tokens import default_token_generator 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 from captcha.fields import CaptchaField
@@ -92,24 +92,24 @@ class PasswordResetForm(forms.Form):
if not domain_override: if not domain_override:
current_site = Site.objects.get_current() current_site = Site.objects.get_current()
site_name = current_site.name site_name = current_site.name
domain = current_site.domain
else: else:
site_name = domain = domain_override site_name = domain_override
service_url = get_service_url()
t = loader.get_template(email_template_name) t = loader.get_template(email_template_name)
c = { c = {
'email': user.username, 'email': user.username,
'domain': domain,
'site_name': site_name, 'site_name': site_name,
'uid': int_to_base36(user.id), 'uid': int_to_base36(user.id),
'user': user, 'user': user,
'token': token_generator.make_token(user), 'token': token_generator.make_token(user),
'protocol': use_https and 'https' or 'http', 'service_url': service_url,
'media_url': settings.MEDIA_URL, 'media_url': settings.MEDIA_URL,
'logo_path': settings.LOGO_PATH, '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]) t.render(Context(c)), None, [user.username])
msg.content_subtype = "html" # Main content is now text/html msg.content_subtype = "html" # Main content is now text/html
msg.send() msg.send()

View File

@@ -1,9 +1,18 @@
{% load url from future %}{% load i18n %}{% autoescape off %} {% extends 'email_base.html' %}
{% 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 }}
{% 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 %} {% endautoescape %}
{% endblock %}

View File

@@ -6,7 +6,7 @@ import simplejson as json
import urllib2 import urllib2
from django.conf import settings 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.paginator import EmptyPage, InvalidPage
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib import messages 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 get_wiki_pages
from seahub.wiki.models import WikiDoesNotExist, WikiPageMissing, GroupWiki from seahub.wiki.models import WikiDoesNotExist, WikiPageMissing, GroupWiki
from seahub.wiki.utils import clean_page_name, get_wiki_dirent 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.shortcuts import get_first_object_or_none
from seahub.utils import render_error, render_permission_error, string2list, \ 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, \ 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.file_types import IMAGE
from seahub.utils.paginator import Paginator from seahub.utils.paginator import Paginator
from seahub.views import is_registered_user from seahub.views import is_registered_user
@@ -640,21 +640,23 @@ def group_manage(request, group_id):
continue continue
if not is_registered_user(email): if not is_registered_user(email):
use_https = request.is_secure() service_url = get_service_url()
domain = RequestSite(request).domain
t = loader.get_template('group/add_member_email.html') t = loader.get_template('group/add_member_email.html')
c = { c = {
'email': username, 'email': username,
'to_email': email, 'to_email': email,
'group': group, 'group': group,
'domain': domain, 'service_url': service_url,
'protocol': use_https and 'https' or 'http',
'site_name': SITE_NAME, 'site_name': SITE_NAME,
'media_url': MEDIA_URL,
'logo_path': LOGO_PATH,
} }
try: try:
send_mail(_(u'Your friend added you to a group at Seafile.'), msg = EmailMessage(_(u'You are invited to join a group on %s.') % SITE_NAME,
t.render(Context(c)), None, [email], t.render(Context(c)), None, [email])
fail_silently=False) msg.content_subtype = "html"
msg.send()
mail_sended_list.append(email) mail_sended_list.append(email)
except Exception, e: except Exception, e:
logger.warn(e) logger.warn(e)

View File

@@ -3,44 +3,28 @@ import datetime
import logging import logging
import string 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.management.base import BaseCommand, CommandError
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from seahub.base.models import CommandsLastCheck from seahub.base.models import CommandsLastCheck
from seahub.notifications.models import UserNotification from seahub.notifications.models import UserNotification
from seahub.utils import get_service_url
import seahub.settings as settings import seahub.settings as settings
from django.template import Context, loader
# Get an instance of a logger # Get an instance of a logger
logger = logging.getLogger(__name__) 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 site_name = settings.SITE_NAME
subjects = (u'New notice on %s' % site_name, u'New notices on %s' % 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): 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" label = "notifications_send_notices"
def handle(self, *args, **options): def handle(self, *args, **options):
@@ -79,14 +63,22 @@ class Command(BaseCommand):
for to_user, count in email_ctx.items(): for to_user, count in email_ctx.items():
subject = subjects[1] if count > 1 else subjects[0] subject = subjects[1] if count > 1 else subjects[0]
template = string.Template(email_templates[1]) if count > 1 else \ t = loader.get_template('notifications/notice_email.html')
string.Template(email_templates[0]) c = {
content = template.substitute(to_user=to_user, count=count, 'site_name': site_name,
site_name=site_name, url=url) 'media_url': media_url,
'logo_path': logo_path,
'service_url': service_url,
'to_user': to_user,
'notice_count': count,
}
try: try:
send_mail(subject, content, settings.DEFAULT_FROM_EMAIL, msg = EmailMessage(subject, t.render(Context(c)), settings.DEFAULT_FROM_EMAIL,
[to_user], fail_silently=False) [to_user])
msg.content_subtype = "html"
msg.send()
logger.info('Successfully sent email to %s' % to_user) logger.info('Successfully sent email to %s' % to_user)
except Exception, e: except Exception, e:
logger.error('Failed to send email to %s, error detail: %s' % (to_user, e)) logger.error('Failed to send email to %s, error detail: %s' % (to_user, e))

View File

@@ -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 %}

View File

@@ -37,7 +37,7 @@ from seahub.views import validate_owner, is_registered_user
from seahub.utils import render_permission_error, string2list, render_error, \ from seahub.utils import render_permission_error, string2list, render_error, \
gen_token, gen_shared_link, gen_shared_upload_link, gen_dir_share_link, \ gen_token, gen_shared_link, gen_shared_upload_link, gen_dir_share_link, \
gen_file_share_link, IS_EMAIL_CONFIGURED, check_filename_with_rename, \ 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 import seahub.settings as settings
try: try:
@@ -800,21 +800,19 @@ def send_shared_link(request):
mail_sended.send(sender=None, user=request.user.username, mail_sended.send(sender=None, user=request.user.username,
email=to_email) email=to_email)
use_https = request.is_secure() service_url = get_service_url()
domain = RequestSite(request).domain
c = { c = {
'email': request.user.username, 'email': request.user.username,
'to_email': to_email, 'to_email': to_email,
'file_shared_link': file_shared_link, 'file_shared_link': file_shared_link,
'site_name': SITE_NAME, 'site_name': SITE_NAME,
'domain': domain, 'service_url': service_url,
'protocol': use_https and 'https' or 'http',
'media_url': settings.MEDIA_URL, 'media_url': settings.MEDIA_URL,
'logo_path': settings.LOGO_PATH, 'logo_path': settings.LOGO_PATH,
} }
try: 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]) t.render(Context(c)), None, [to_email])
msg.content_subtype = "html" msg.content_subtype = "html"
msg.send() msg.send()
@@ -1081,22 +1079,19 @@ def send_shared_upload_link(request):
mail_sended.send(sender=None, user=request.user.username, mail_sended.send(sender=None, user=request.user.username,
email=to_email) email=to_email)
service_url = get_service_url()
use_https = request.is_secure()
domain = RequestSite(request).domain
c = { c = {
'email': request.user.username, 'email': request.user.username,
'to_email': to_email, 'to_email': to_email,
'shared_upload_link': shared_upload_link, 'shared_upload_link': shared_upload_link,
'site_name': SITE_NAME, 'site_name': SITE_NAME,
'domain': domain, 'service_url': service_url,
'protocol': use_https and 'https' or 'http',
'media_url': settings.MEDIA_URL, 'media_url': settings.MEDIA_URL,
'logo_path': settings.LOGO_PATH, 'logo_path': settings.LOGO_PATH,
} }
try: 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]) t.render(Context(c)), None, [to_email])
msg.content_subtype = "html" msg.content_subtype = "html"
msg.send() msg.send()

View File

@@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
<div style="background:#f2f2f2;padding:40px 0;"> <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;"> <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;"> <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 %} {% block email_con %}{% endblock %}

View File

@@ -8,17 +8,13 @@
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p> <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;"> <p style="font-size:14px;color:#434144;">
{% trans "Please go to the following page and choose a new password:" %}<br /> {% blocktrans with account=user.username %}To reset the password of your account {{ account }} on {{ site_name }}, please click the following link: {% endblocktrans %}<br />
{% block reset_link %} {{ service_url }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}
{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}
{% endblock %}
</p> </p>
<p style="font-size:14px;color:#434144;"> <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> </p>
{% endautoescape %} {% endautoescape %}

View File

@@ -9,11 +9,7 @@
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p> <p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
<p style="font-size:14px;color:#434144;"> <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%} {% blocktrans %}{{ email }} shared a file to you on {{ site_name }}:{% endblocktrans%} <br />
</p>
<p style="font-size:14px;color:#434144;">
{% trans "Please go to the following page and view the file:" %}<br />
{{ file_shared_link }} {{ file_shared_link }}
</p> </p>

View File

@@ -8,7 +8,7 @@
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p> <p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
<p style="font-size:14px;color:#434144;"> <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>
<p style="font-size:14px;color:#434144;"> <p style="font-size:14px;color:#434144;">

View 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 %}

View File

@@ -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 %}

View File

@@ -1 +0,0 @@
{% load i18n %}{% blocktrans %}Your account on {{site_name}} is activated{% endblocktrans %}

View File

@@ -10,22 +10,19 @@
<p style="font-size:14px;color:#434144;"> <p style="font-size:14px;color:#434144;">
{% if org %} {% 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 %} {% 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 %} {% endif %}
</p> </p>
<p style="font-size:14px;color:#434144;"> <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 %}Email: {{ email }}{% endblocktrans %}<br />
{% blocktrans %}Password: {{ password }}{% endblocktrans %} {% blocktrans %}Password: {{ password }}{% endblocktrans %}
</p> </p>
<p style="font-size:14px;color:#434144;"> <a href="{{ service_url }}{% url 'auth_login' %}" target="_blank">{% trans "Log In" %}</a>
{% trans "Please go to the following page and log in:" %}<br />
{{ protocol }}://{{ domain }}{% url 'auth_login' %}
</p>
{% endautoescape %} {% endautoescape %}

View File

@@ -9,11 +9,7 @@
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p> <p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
<p style="font-size:14px;color:#434144;"> <p style="font-size:14px;color:#434144;">
{% blocktrans %}You're receiving this e-mail because staff has reset your password at {{ site_name }}. {% endblocktrans %} {% blocktrans %}Your password on {{ site_name }} has been reset. Now it is {{ password }}. Please change it as soon as possible. {% endblocktrans %}
</p>
<p style="font-size:14px;color:#434144;">
{% blocktrans %}Your new password is {{ password }}, please modify your password as soon as possible.{% endblocktrans %}
</p> </p>
{% endautoescape %} {% endautoescape %}

View File

@@ -18,7 +18,6 @@ from urllib import quote
from django.core.cache import cache from django.core.cache import cache
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from django.contrib import messages from django.contrib import messages
from django.contrib.sites.models import Site, RequestSite from django.contrib.sites.models import Site, RequestSite
from django.db import IntegrityError from django.db import IntegrityError

View File

@@ -33,7 +33,7 @@ from seahub.share.models import FileShare
import seahub.settings as settings import seahub.settings as settings
from seahub.settings import INIT_PASSWD, \ from seahub.settings import INIT_PASSWD, \
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER, SEND_EMAIL_ON_RESETTING_USER_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__) logger = logging.getLogger(__name__)
@@ -407,20 +407,21 @@ def user_deactivate(request, user_id):
def email_user_on_activation(user): def email_user_on_activation(user):
"""Send an email to user when admin activate his/her account. """Send an email to user when admin activate his/her account.
""" """
ctx_dict = { service_url = get_service_url()
"site_name": settings.SITE_NAME, site_name = settings.SITE_NAME
"login_url": "%s%s" % (get_site_scheme_and_netloc(),
reverse('auth_login')), t = loader.get_template('sysadmin/user_activation_email.html')
"username": user.email, 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', msg = EmailMessage(_(u'Your account on s% is activated') % site_name, t.render(Context(c)),
ctx_dict) None, [user.email])
# Email subject *must not* contain newlines msg.content_subtype = "html"
subject = ''.join(subject.splitlines()) msg.send()
message = render_to_string('sysadmin/user_activation_email.txt', ctx_dict)
user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
@login_required @login_required
@sys_staff_required @sys_staff_required
@@ -459,22 +460,19 @@ def send_user_reset_email(request, email, password):
Send email when reset user password. Send email when reset user password.
""" """
use_https = request.is_secure() service_url = get_service_url()
domain = RequestSite(request).domain site_name = settings.SITE_NAME
t = loader.get_template('sysadmin/user_reset_email.html') t = loader.get_template('sysadmin/user_reset_email.html')
c = { c = {
'email': email, 'email': email,
'password': password, 'password': password,
'site_name': settings.SITE_NAME, 'site_name': site_name,
'media_url': settings.MEDIA_URL,
'logo_path': settings.LOGO_PATH,
'domain': domain,
'protocol': use_https and 'https' or 'http',
'media_url': settings.MEDIA_URL, 'media_url': settings.MEDIA_URL,
'logo_path': settings.LOGO_PATH, '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]) None, [email])
msg.content_subtype = "html" msg.content_subtype = "html"
msg.send() msg.send()
@@ -519,8 +517,8 @@ def user_reset(request, user_id):
def send_user_add_mail(request, email, password): def send_user_add_mail(request, email, password):
"""Send email when add new user.""" """Send email when add new user."""
use_https = request.is_secure() service_url = get_service_url()
domain = RequestSite(request).domain site_name = settings.SITE_NAME
t = loader.get_template('sysadmin/user_add_email.html') t = loader.get_template('sysadmin/user_add_email.html')
c = { c = {
@@ -528,13 +526,12 @@ def send_user_add_mail(request, email, password):
'org': request.user.org, 'org': request.user.org,
'email': email, 'email': email,
'password': password, 'password': password,
'domain': domain, 'service_url': service_url,
'protocol': use_https and 'https' or 'http', 'site_name': site_name,
'site_name': settings.SITE_NAME,
'media_url': settings.MEDIA_URL, 'media_url': settings.MEDIA_URL,
'logo_path': settings.LOGO_PATH, '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]) None, [email])
msg.content_subtype = "html" msg.content_subtype = "html"
msg.send() msg.send()