def _send_mail(locale): subject = _(u'[SUMO] You have a new private message from [{sender}]') subject = subject.format(sender=inbox_message.sender.username) context = { 'sender': inbox_message.sender.username, 'message': inbox_message.message, 'url': reverse('messages.read', kwargs={'msgid': inbox_message.id}), 'unsubscribe_url': reverse('users.edit_settings'), 'host': Site.objects.get_current().domain } text_template = 'messages/email/private_message.ltxt' html_template = None msg = EmailMultiAlternatives(subject, render_email(text_template, context), settings.TIDINGS_FROM_ADDRESS, [inbox_message.to.email]) if html_template: msg.attach_alternative(render_email(html_template, context), 'text/html') send_messages([msg])
def _send_mail(locale): subject = _(u'[SUMO] You have a new private message from [{sender}]') subject = subject.format(sender=inbox_message.sender.username) context = { 'sender': inbox_message.sender.username, 'message': inbox_message.message, 'url': reverse('messages.read', kwargs={'msgid': inbox_message.id}), 'unsubscribe_url': reverse('users.edit_settings'), 'host': Site.objects.get_current().domain} text_template = 'messages/email/private_message.ltxt' html_template = None msg = EmailMultiAlternatives( subject, render_email(text_template, context), settings.TIDINGS_FROM_ADDRESS, [inbox_message.to.email]) if html_template: msg.attach_alternative( render_email(html_template, context), 'text/html') send_messages([msg])
def _make_mail(locale): msg = EmailMultiAlternatives( subject, email_utils.render_email(text_template, email_kwargs), settings.DEFAULT_FROM_EMAIL, [send_to]) if html_template: msg.attach_alternative( email_utils.render_email(html_template, email_kwargs), 'text/html') return msg
def _make_mail(locale, user): subject = _("New announcement for {group}").format(group=group.name) msg = EmailMultiAlternatives( subject, render_email(text_template, email_kwargs), settings.TIDINGS_FROM_ADDRESS, [user.email] ) if html_template: msg.attach_alternative(render_email(html_template, email_kwargs), "text/html") return msg
def _make_mail(locale, user): subject = _('New announcement for {group}').format(group=group.name) msg = EmailMultiAlternatives(subject, render_email(text_template, email_kwargs), settings.TIDINGS_FROM_ADDRESS, [user.email]) if html_template: msg.attach_alternative(render_email(html_template, email_kwargs), 'text/html') return msg
def _make_mail(locale): msg = EmailMultiAlternatives( subject, email_utils.render_email(text_template, email_kwargs), settings.DEFAULT_FROM_EMAIL, [send_to]) if html_template: msg.attach_alternative( email_utils.render_email( html_template, email_kwargs), 'text/html') return msg
def _send_mail(locale, user, context): subject = _('Your username on %s') % site_name msg = EmailMultiAlternatives( subject, email_utils.render_email(text_template, context), settings.TIDINGS_FROM_ADDRESS, [user.email]) if html_template: msg.attach_alternative( email_utils.render_email(html_template, context), 'text/html') email_utils.send_messages([msg])
def _send_mail(locale, user, context): subject = _('Your username on %s') % site_name msg = EmailMultiAlternatives( subject, email_utils.render_email(text_template, context), settings.TIDINGS_FROM_ADDRESS, [user.email]) if html_template: msg.attach_alternative( email_utils.render_email( html_template, context), 'text/html') email_utils.send_messages([msg])
def notification_mails(revision, subject, template, url, users_and_watches): """Return EmailMessages in the KB's standard notification mail format.""" document = revision.document for u, w in users_and_watches: if hasattr(u, 'profile'): locale = u.profile.locale else: locale = document.locale with email_utils.uselocale(locale): c = context_dict(revision) # TODO: Expose all watches c['watch'] = w[0] c['url'] = url subject = subject.format(title=document.title, creator=revision.creator, locale=document.locale) msg = email_utils.render_email(template, c) yield EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [u.email])
def _mails(self, users_and_watches): """Send readiness mails. """ revision = self.revision document = revision.document log.debug('Sending ready notifications for revision (id=%s)' % revision.id) for user, watches in users_and_watches: if hasattr(user, 'profile'): locale = user.profile.locale else: locale = document.locale with email_utils.uselocale(locale): subject = _(u'{title} has a revision ready for ' 'localization').format(title=document.title) template = 'wiki/email/ready_for_l10n.ltxt' c = context_dict(revision, ready_for_l10n=True) # TODO: Expose all watches c['watch'] = watches[0] c['url'] = django_reverse('wiki.select_locale', args=[document.slug]) msg = email_utils.render_email(template, c) yield EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email])
def email_private_message(inbox_message_id): """Send notification of a new private message.""" inbox_message = InboxMessage.objects.get(id=inbox_message_id) log.debug('Sending email for user (%s)' % (inbox_message.to,)) user = inbox_message.to if hasattr(user, 'profile'): locale = user.profile.locale else: locale = settings.WIKI_DEFAULT_LANGUAGE with uselocale(locale): subject = _(u'[SUMO] You have a new private message from [{sender}]') subject = subject.format(sender=inbox_message.sender.username) context = { 'sender': inbox_message.sender.username, 'message': inbox_message.message, 'url': reverse('messages.read', kwargs={'msgid': inbox_message.id}), 'unsubscribe_url': reverse('users.edit_settings'), 'host': Site.objects.get_current().domain} template = 'messages/email/private_message.ltxt' msg = render_email(template, context) send_mail(subject, msg, settings.TIDINGS_FROM_ADDRESS, [inbox_message.to.email])
def send_group_email(announcement_id): """Build and send the announcement emails to a group.""" try: announcement = Announcement.objects.get(pk=announcement_id) except Announcement.DoesNotExist: return connection = get_connection(fail_silently=True) connection.open() group = announcement.group users = User.objects.filter(groups__in=[group]) plain_content = bleach.clean(announcement.content_parsed, tags=[], strip=True).strip() email_kwargs = {'content': plain_content, 'domain': Site.objects.get_current().domain} template = 'announcements/email/announcement.ltxt' try: for u in users: # Localize email each time. with uselocale(u.profile.locale or settings.LANGUAGE_CODE): subject = _('New announcement for {group}').format( group=group.name) msg = render_email(template, email_kwargs) m = EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [u.email]) connection.send_messages([m]) finally: connection.close()
def _mails(self, users_and_watches): question = self.instance # Cache solution.question as a workaround for replication lag # (bug 585029) question.solution = self.answer question.solution.question = question c = {'answerer': question.solution.creator, 'asker': question.creator.username, 'question_title': question.title, 'host': Site.objects.get_current().domain, 'solution_url': question.solution.get_absolute_url()} for u, w in users_and_watches: c['username'] = u.username # '' if anonymous c['watch'] = w[0] # TODO: Expose all watches. # u here can be a Django User model or a Tidings EmailUser # model. In the case of the latter, there is no associated # profile, so we set the locale to en-US. if hasattr(u, 'profile'): locale = u.profile.locale else: locale = 'en-US' with email_utils.uselocale(locale): subject = _(u'Solution found to Firefox Help question') content = email_utils.render_email( 'questions/email/solution.ltxt', c) yield EmailMessage( subject, content, settings.TIDINGS_FROM_ADDRESS, [u.email])
def _send_email(self, confirmation_profile, url, subject, email_template, send_to, **kwargs): """ Send an email using a passed in confirmation profile. Use specified url, subject, email_template, and email to send_to. """ current_site = Site.objects.get_current() email_kwargs = {'activation_key': confirmation_profile.activation_key, 'domain': current_site.domain, 'activate_url': url, 'login_url': reverse('users.login')} email_kwargs.update(kwargs) # RegistrationProfile doesn't have a locale attribute. So if # we get one of those, then we have to get the real profile # from the user. if hasattr(confirmation_profile, 'locale'): locale = confirmation_profile.locale else: locale = confirmation_profile.user.profile.locale with email_utils.uselocale(locale): message = email_utils.render_email(email_template, email_kwargs) mail.send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [send_to])
def _make_mail(locale, user, context): subject = _(u'Solution found to Firefox Help question') content = email_utils.render_email('questions/email/solution.ltxt', context) return EmailMessage(subject, content, settings.TIDINGS_FROM_ADDRESS, [user.email])
def _make_mail(locale, user, watches): if (is_ready and ReadyRevisionEvent.event_type in (w.event_type for w in watches)): c = context_dict(revision, ready_for_l10n=True) # TODO: Expose all watches c['watch'] = watches[0] c['url'] = django_reverse('wiki.select_locale', args=[document.slug]) subject = _(u'{title} has a revision ready for ' 'localization') text_template = 'wiki/email/ready_for_l10n.ltxt' html_template = None else: c = context_dict(revision, revision_approved=True) approved_url = reverse('wiki.document', locale=document.locale, args=[document.slug]) c['url'] = approved_url # TODO: Expose all watches. c['watch'] = watches[0] c['reviewer'] = revision.reviewer.username subject = _(u'{title} ({locale}) has a new approved ' 'revision ({reviewer})') text_template = 'wiki/email/approved.ltxt' html_template = None subject = subject.format( title=document.title, reviewer=revision.reviewer.username, locale=document.locale) msg = EmailMultiAlternatives( subject, email_utils.render_email(text_template, c), settings.TIDINGS_FROM_ADDRESS, [user.email]) if html_template: msg.attach_alternative( email_utils.render_email(html_template, c), 'text/html') return msg
def _make_mail(locale, user): subject = _('New announcement for {group}').format( group=group.name) msg = render_email(template, email_kwargs) m = EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email]) return [m]
def _make_mail(locale, user, watches): if (is_ready and ReadyRevisionEvent.event_type in (w.event_type for w in watches)): c = context_dict(revision, ready_for_l10n=True) # TODO: Expose all watches c['watch'] = watches[0] c['url'] = django_reverse('wiki.select_locale', args=[document.slug]) subject = _(u'{title} has a revision ready for ' 'localization') text_template = 'wiki/email/ready_for_l10n.ltxt' html_template = None else: c = context_dict(revision, revision_approved=True) approved_url = reverse('wiki.document', locale=document.locale, args=[document.slug]) c['url'] = approved_url # TODO: Expose all watches. c['watch'] = watches[0] c['reviewer'] = revision.reviewer.username subject = _(u'{title} ({locale}) has a new approved ' 'revision ({reviewer})') text_template = 'wiki/email/approved.ltxt' html_template = None subject = subject.format(title=document.title, reviewer=revision.reviewer.username, locale=document.locale) msg = EmailMultiAlternatives( subject, email_utils.render_email(text_template, c), settings.TIDINGS_FROM_ADDRESS, [user.email]) if html_template: msg.attach_alternative( email_utils.render_email(html_template, c), 'text/html') return msg
def _make_mail(locale): subject = _("Please confirm your email address") email_kwargs = { "activation_url": cls._activation_url(watch), "domain": Site.objects.get_current().domain, "watch_description": cls.description_of_watch(watch), } template = "questions/email/activate_watch.ltxt" message = email_utils.render_email(template, email_kwargs) return EmailMessage(subject, message, settings.TIDINGS_FROM_ADDRESS, [email])
def resend_confirmation(request, template): """Resend confirmation email.""" if request.method == 'POST': form = EmailConfirmationForm(request.POST) if form.is_valid(): email = form.cleaned_data['email'] try: reg_prof = RegistrationProfile.objects.get( user__email=email) if not reg_prof.user.is_active: form = try_send_email_with_form( RegistrationProfile.objects.send_confirmation_email, form, 'email', reg_prof) else: form = try_send_email_with_form( RegistrationProfile.objects.send_confirmation_email, form, 'email', reg_prof, text_template='users/email/already_activated.ltxt', html_template='users/email/already_activated.html', subject=_('Account already activated')) except RegistrationProfile.DoesNotExist: # Send already active email if user exists try: user = User.objects.get(email=email, is_active=True) current_site = Site.objects.get_current() email_kwargs = {'domain': current_site.domain, 'login_url': reverse('users.login')} subject = _('Account already activated') message = email_utils.render_email( 'users/email/already_activated.ltxt', email_kwargs) # TODO: Send HTML email here. form = try_send_email_with_form( mail.send_mail, form, 'email', subject, message, settings.DEFAULT_FROM_EMAIL, [user.email]) except User.DoesNotExist: # Don't leak existence of email addresses. pass # Form may now be invalid if email failed to send. if form.is_valid(): return render( request, template + 'resend_confirmation_done.html', {'email': email}) else: form = EmailConfirmationForm() return render(request, template + 'resend_confirmation.html', { 'form': form})
def _make_mail(locale): subject = _('Please confirm your email address') email_kwargs = { 'activation_url': cls._activation_url(watch), 'domain': Site.objects.get_current().domain, 'watch_description': cls.description_of_watch(watch) } template = 'questions/email/activate_watch.ltxt' message = email_utils.render_email(template, email_kwargs) return EmailMessage(subject, message, settings.TIDINGS_FROM_ADDRESS, [email])
def resend_confirmation(request, template): """Resend confirmation email.""" if request.method == 'POST': form = EmailConfirmationForm(request.POST) if form.is_valid(): email = form.cleaned_data['email'] try: reg_prof = RegistrationProfile.objects.get(user__email=email) if not reg_prof.user.is_active: form = try_send_email_with_form( RegistrationProfile.objects.send_confirmation_email, form, 'email', reg_prof) else: form = try_send_email_with_form( RegistrationProfile.objects.send_confirmation_email, form, 'email', reg_prof, text_template='users/email/already_activated.ltxt', html_template='users/email/already_activated.html', subject=_('Account already activated')) except RegistrationProfile.DoesNotExist: # Send already active email if user exists try: user = User.objects.get(email=email, is_active=True) current_site = Site.objects.get_current() email_kwargs = { 'domain': current_site.domain, 'login_url': reverse('users.login') } subject = _('Account already activated') message = email_utils.render_email( 'users/email/already_activated.ltxt', email_kwargs) # TODO: Send HTML email here. form = try_send_email_with_form( mail.send_mail, form, 'email', subject, message, settings.DEFAULT_FROM_EMAIL, [user.email]) except User.DoesNotExist: # Don't leak existence of email addresses. pass # Form may now be invalid if email failed to send. if form.is_valid(): return render(request, template + 'resend_confirmation_done.html', {'email': email}) else: form = EmailConfirmationForm() return render(request, template + 'resend_confirmation.html', {'form': form})
def _make_mail(locale, user): if revision.is_approved: subject = _(u'Your revision has been approved: {title}') else: subject = _(u'Your revision has been reviewed: {title}') subject = subject.format(title=document.title) template = 'wiki/email/reviewed.ltxt' msg = email_utils.render_email(template, c) msgs.append( EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email]))
def _make_mail(locale, user): if revision.is_approved: subject = _(u'Your revision has been approved: {title}') else: subject = _(u'Your revision has been reviewed: {title}') subject = subject.format(title=document.title) template = 'wiki/email/reviewed.ltxt' msg = email_utils.render_email(template, c) msgs.append(EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email]))
def _make_mail(locale, user, context): is_asker = asker_id == user.id if is_asker: subject = _( u'%s posted an answer to your question "%s"' % (self.answer.creator.username, self.instance.title) ) template = "questions/email/new_answer_to_asker.ltxt" else: subject = _(u"%s commented on a Firefox question " "you're watching" % self.answer.creator.username) template = "questions/email/new_answer.ltxt" msg = email_utils.render_email(template, context) return EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email])
def _make_mail(locale, user): if revision.is_approved: subject = _(u'A revision you contributed to has ' 'been approved: {title}') else: subject = _(u'A revision you contributed to has ' 'been reviewed: {title}') subject = subject.format(title=document.title) msg = email_utils.render_email(template, c) msgs.append(EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email]))
def save(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', text_template=None, html_template=None, use_https=False, token_generator=default_token_generator, from_email=None, request=None): """ Based off of django's but uses jingo and handles html and plain-text emails """ for user in self.users_cache: if not domain_override: current_site = get_current_site(request) site_name = current_site.name domain = current_site.domain else: site_name = domain = domain_override c = { 'email': user.email, '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', } subject = email_utils.render_email(subject_template_name, c) # Email subject *must not* contain newlines subject = ''.join(subject.splitlines()) @email_utils.safe_translation def _make_mail(locale): mail = email_utils.make_mail( subject=subject, text_template=text_template, html_template=html_template, context_vars=c, from_email=from_email, to_email=user.email) return mail if request: locale = request.LANGUAGE_CODE else: locale = settings.WIKI_DEFAULT_LANGUAGE email_utils.send_messages([_make_mail(locale)])
def _make_mail(locale, user): if revision.is_approved: subject = _(u'A revision you contributed to has ' 'been approved: {title}') else: subject = _(u'A revision you contributed to has ' 'been reviewed: {title}') subject = subject.format(title=document.title) msg = email_utils.render_email(template, c) msgs.append( EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email]))
def _make_mail(locale, user, context): is_asker = asker_id == user.id if is_asker: subject = _( u'%s posted an answer to your question "%s"' % (self.answer.creator.username, self.instance.title)) template = 'questions/email/new_answer_to_asker.ltxt' else: subject = _(u'%s commented on a Firefox question ' "you're watching" % self.answer.creator.username) template = 'questions/email/new_answer.ltxt' msg = email_utils.render_email(template, context) return EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email])
def _send_mail(locale): subject = _(u'[SUMO] You have a new private message from [{sender}]') subject = subject.format(sender=inbox_message.sender.username) context = { 'sender': inbox_message.sender.username, 'message': inbox_message.message, 'url': reverse('messages.read', kwargs={'msgid': inbox_message.id}), 'unsubscribe_url': reverse('users.edit_settings'), 'host': Site.objects.get_current().domain} template = 'messages/email/private_message.ltxt' msg = render_email(template, context) send_mail(subject, msg, settings.TIDINGS_FROM_ADDRESS, [inbox_message.to.email])
def send_contributor_notification(based_on, revision, document, message): """Send notification of review to the contributors of revisions.""" template = 'wiki/email/reviewed_contributors.ltxt' url = reverse('wiki.document_revisions', locale=document.locale, args=[document.slug]) c = {'document_title': document.title, 'approved': revision.is_approved, 'reviewer': revision.reviewer, 'message': message, 'url': url, 'host': Site.objects.get_current().domain} msgs = [] for r in based_on: # Send email to all contributors except the reviewer and the creator # of the approved revision. if r.creator in [revision.creator, revision.reviewer]: continue user = r.creator if hasattr(user, 'profile'): locale = user.profile.locale else: locale = settings.WIKI_DEFAULT_LANGUAGE with email_utils.uselocale(locale): if revision.is_approved: subject = _(u'A revision you contributed to has ' 'been approved: {title}') else: subject = _(u'A revision you contributed to has ' 'been reviewed: {title}') subject = subject.format(title=document.title) msg = email_utils.render_email(template, c) msgs.append(EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email])) email_utils.send_messages(msgs)
def _mails(self, users_and_watches): """Send one kind of mail to the asker and another to other watchers.""" # Cache answer.question, similar to caching solution.question below. self.answer.question = self.instance asker_id = self.answer.question.creator.id c = {'answer': self.answer.content, 'answerer': self.answer.creator.username, 'question_title': self.instance.title, 'host': Site.objects.get_current().domain, 'answer_url': self.answer.get_absolute_url()} for u, w in users_and_watches: c['helpful_url'] = self.answer.get_helpful_answer_url() c['solution_url'] = self.answer.get_solution_url(watch=w[0]) c['username'] = u.username c['watch'] = w[0] # TODO: Expose all watches. # u here can be a Django User model or a Tidings EmailUser # model. In the case of the latter, there is no associated # profile, so we set the locale to en-US. if hasattr(u, 'profile'): locale = u.profile.locale else: locale = 'en-US' with email_utils.uselocale(locale): is_asker = asker_id == u.id if is_asker: subject = _(u'%s posted an answer to your question "%s"' % (self.answer.creator.username, self.instance.title)) template = 'questions/email/new_answer_to_asker.ltxt' else: subject = _(u'%s commented on a Firefox question ' "you're watching" % self.answer.creator.username) template = 'questions/email/new_answer.ltxt' msg = email_utils.render_email(template, c) yield EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [u.email])
def send_reviewed_notification(revision, document, message): """Send notification of review to the revision creator.""" if revision.reviewer == revision.creator: log.debug('Revision (id=%s) reviewed by creator, skipping email' % revision.id) return log.debug('Sending reviewed email for revision (id=%s)' % revision.id) url = reverse('wiki.document_revisions', locale=document.locale, args=[document.slug]) c = {'document_title': document.title, 'approved': revision.is_approved, 'reviewer': revision.reviewer, 'message': message, 'url': url, 'host': Site.objects.get_current().domain} msgs = [] for user in [revision.creator, revision.reviewer]: if hasattr(user, 'profile'): locale = user.profile.locale else: locale = settings.WIKI_DEFAULT_LANGUAGE with email_utils.uselocale(locale): if revision.is_approved: subject = _(u'Your revision has been approved: {title}') else: subject = _(u'Your revision has been reviewed: {title}') subject = subject.format(title=document.title) template = 'wiki/email/reviewed.ltxt' msg = email_utils.render_email(template, c) msgs.append(EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email])) email_utils.send_messages(msgs)
def save(self, email_template='users/email/forgot_username.ltxt', use_https=False, request=None): """Sends email with username.""" user = self.user current_site = get_current_site(request) site_name = current_site.name domain = current_site.domain c = { 'email': user.email, 'domain': domain, 'login_url': reverse('users.login'), 'site_name': site_name, 'username': user.username, 'protocol': use_https and 'https' or 'http'} subject = _("Your username on %s") % site_name message = email_utils.render_email(email_template, c) send_mail(subject, message, settings.TIDINGS_FROM_ADDRESS, [user.email])
def _activation_email(cls, watch, email): """Return an EmailMessage containing the activation URL to be sent to a new watcher. """ # If the watch has an associated user, use that # locale. Otherwise it's an anonymous watch and we don't know # what locale they want, so we give them en-US. if watch.user: locale = watch.user.profile.locale else: locale = 'en-US' with email_utils.uselocale(locale): subject = _('Please confirm your email address') email_kwargs = {'activation_url': cls._activation_url(watch), 'domain': Site.objects.get_current().domain, 'watch_description': cls.description_of_watch(watch)} template = 'questions/email/activate_watch.ltxt' message = email_utils.render_email(template, email_kwargs) return EmailMessage(subject, message, settings.TIDINGS_FROM_ADDRESS, [email])
def _mails(self, users_and_watches): """Send approval or readiness mails, as appropriate. If a given user is watching the Ready event and the revision is in fact ready, say so. Otherwise, just send the Approval email. """ revision = self._revision document = revision.document is_ready = revision.is_ready_for_localization log.debug('Sending approved/ready notifications for revision (id=%s)' % revision.id) for user, watches in users_and_watches: # Figure out the locale to use for l10n. if hasattr(user, 'profile'): locale = user.profile.locale else: locale = document.locale # Localize the subject and message with the appropriate # context. with email_utils.uselocale(locale): if (is_ready and ReadyRevisionEvent.event_type in (w.event_type for w in watches)): c = context_dict(revision, ready_for_l10n=True) # TODO: Expose all watches c['watch'] = watches[0] c['url'] = django_reverse('wiki.select_locale', args=[document.slug]) subject = _(u'{title} has a revision ready for ' 'localization') template = 'wiki/email/ready_for_l10n.ltxt' else: c = context_dict(revision, revision_approved=True) approved_url = reverse('wiki.document', locale=document.locale, args=[document.slug]) c['url'] = approved_url # TODO: Expose all watches. c['watch'] = watches[0] c['reviewer'] = revision.reviewer.username subject = _(u'{title} ({locale}) has a new approved ' 'revision ({reviewer})') template = 'wiki/email/approved.ltxt' subject = subject.format( title=document.title, reviewer=revision.reviewer.username, locale=document.locale) msg = email_utils.render_email(template, c) yield EmailMessage(subject, msg, settings.TIDINGS_FROM_ADDRESS, [user.email])
def _message(locale): return email_utils.render_email(email_template, email_kwargs)
def _make_mail(locale, user, context): subject = _(u"Solution found to Firefox Help question") content = email_utils.render_email("questions/email/solution.ltxt", context) return EmailMessage(subject, content, settings.TIDINGS_FROM_ADDRESS, [user.email])