示例#1
0
def send_status_change_email(idea):
    subscribers = Subscription.objects.filter(
        idea=idea, muted=False).exclude(user=idea.created_by)
    idea_url = ''.join(
        ['https://',
         get_current_site(None).domain,
         idea.get_absolute_url()])

    for s in subscribers:
        membership = Member.objects.get(user=s.user, company=idea.company)
        if s.muted:
            continue

        mute_url = ''.join([
            'https://',
            get_current_site(None).domain, '/mute/' + s.key + '/'
        ])

        try:
            send_templated_email(
                [s.user.email], "emails/status_changed", {
                    'first_name': s.user.first_name,
                    'idea_url': idea_url,
                    'user_email': s.user.email,
                    'mute_url': mute_url,
                    'idea': idea,
                }, s.idea.company.title + ' <noreply+' + s.idea.company.slug +
                '@wantoo.io>')
        except:
            print 'send_status_change_email fail'
            pass
示例#2
0
def notify_admin_for_new_idea(idea):
    idea_url = ''.join(
        ['https://',
         get_current_site(None).domain,
         idea.get_absolute_url()])
    edit_url = ''.join([
        'https://',
        get_current_site(None).domain,
        '/' + idea.company.slug + '/edit-idea/' + str(idea.id) + '/'
    ])
    author_url = ''.join([
        'https://',
        get_current_site(None).domain,
        '/' + idea.company.slug + '/member/' + str(idea.created_by.id) + '/'
    ])

    try:
        send_templated_email(
            [idea.company.created_by.email], "emails/idea_submitted", {
                'idea': idea,
                'first_name': idea.company.created_by.first_name,
                'author_url': author_url,
                'idea_url': idea_url,
                'edit_url': edit_url,
            })
    except:
        print 'notify_admin_for_new_idea fail'
        pass
示例#3
0
    def form_invalid(self, form):
        # HACK: Make use of the invalid form for handling the 'Connect my account
        # to a player' request
        if self.request.POST.get('request_link') == '1':
            try:
                send_templated_email([settings.SERVER_EMAIL],
                                     'emails/req_player_link',
                                     {
                                         'user': self.request.user,
                                         'base_url': "//" + Site.objects.get_current().domain
                                     })
            except:
                LOG.error("Failed to send player link request email for {}".format(self.request.user), exc_info=True)
                messages.error(
                    self.request,
                    "Sorry - we were unable to handle your request. Please try again later.")
            else:
                messages.success(
                    self.request,
                    "Thanks - your request to be linked to a player/club member has been sent to the website administrator.")
        else:
            messages.error(
                self.request,
                "Failed to update profile. Errors: {}".format(form.errors))

        return super(ProfileView, self).form_invalid(form)
示例#4
0
    def send_confirmation(self, email_address):
        salt = sha_constructor(str(random())).hexdigest()[:5]
        confirmation_key = sha_constructor(salt + email_address.email).hexdigest()
        current_site = Site.objects.get_current()
        # check for the url with the dotted view path
        try:
            path = reverse("emailconfirmation.views.confirm_email",
                args=[confirmation_key])
        except NoReverseMatch:
            # or get path with named urlconf instead
            path = reverse(
                "emailconfirmation_confirm_email", args=[confirmation_key])
        activate_url = u"http://%s%s" % (unicode(current_site.domain), path)
        context = {
            "user": email_address.user,
            "activate_url": activate_url,
            "current_site": current_site,
            "confirmation_key": confirmation_key,
        }

        send_templated_email([email_address.user], "emails/emailconfirmation",
                                context)

        return self.create(
            email_address=email_address,
            sent=now(),
            confirmation_key=confirmation_key)
示例#5
0
def send_mail(request, company_slug=None):

    if not request.user.is_authenticated():
        return HttpResponseForbidden()

    company = get_object_or_404(Company, slug=company_slug)

    if not has_admin_permission(request.user, company):
        return HttpResponseForbidden()
    else:

        usr_name = request.user.get_full_name()
        usr_email = request.user.email
        usr_url = 'http://wantoo.io/' + request.data.get('company')

        try:
            send_templated_email(
                ["*****@*****.**"], "emails/pro_admin", {
                    'full_name': usr_name,
                    'author_email': usr_email,
                    'author_url': usr_url,
                })
            return Response('Success email sent.')
        except:
            return Response('There was a problem sending the email...')
示例#6
0
def create_user_detail(sender, **kwargs):
    user = kwargs.pop('user')
    request = kwargs.pop('request')
    plan_type = request.POST.get('plan_type', False)
    # if plan_type  == 'pro':
    #     for feature in DarkLaunch.objects.all():
    #             feature.users.add(user)

    ######### 
    usr_name = user.get_full_name()
    usr_email =  user.email
    if not plan_type:
        plan_type = 'NO PLAN TYPE'
    try:
        send_templated_email(['*****@*****.**'], "emails/sign_up_admin", {
            'full_name': usr_name,
            'author_email': usr_email,
            'plan_type': plan_type,
        })
    except:
        print 'Email didnt end...'
    #########   

    try:
        user_detail = UserDetail.objects.get(user=user)
        return
    except:
        user_detail = UserDetail()
        user_detail.user = user
        if 'casl' in request.POST:
            user_detail.casl = True
        else:
            user_detail.casl = False
        user_detail.save()
def send_digest_for_company(company):
    print '-----------' 
    print 'Company: ', company.slug
    ideas = Idea.objects.filter(company=company, created_at__gte=seven_days_ago, merged_into__isnull=True)
    if ideas:
        print str(ideas.count()) + ' ideas'
    else:
        print 'No new ideas'
        return

    company_url = ''.join(['https://', get_current_site(None).domain, '/', company.slug, '/'])
    base_url = ''.join(['https://', get_current_site(None).domain, '/'])

    members = Member.objects.filter(company=company)

    for member in members:

        if not member.user.user_detail.email_digest:
            continue

        settings_url = ''.join(['https://', get_current_site(None).domain,'/' + company.slug + '/member/' + str(member.user.id) +'/preferences/notifications/' ])
        try:
            send_templated_email([member.user.email], "emails/digest", {
                'first_name':member.user.first_name,
                'ideas': ideas,
                'company': company,
                'company_url': company_url,
                'user_email': member.user.email,
                'settings_url': settings_url,
                'base_url': base_url,
            }, company.title + ' <noreply+' + company.slug + '@wantoo.io>')       
        except:
            print 'Digest send fail'
示例#8
0
    def send_confirmation(self, email_address):
        salt = sha_constructor(str(random())).hexdigest()[:5]
        confirmation_key = sha_constructor(salt +
                                           email_address.email).hexdigest()
        current_site = Site.objects.get_current()
        # check for the url with the dotted view path
        try:
            path = reverse("emailconfirmation.views.confirm_email",
                           args=[confirmation_key])
        except NoReverseMatch:
            # or get path with named urlconf instead
            path = reverse("emailconfirmation_confirm_email",
                           args=[confirmation_key])
        activate_url = u"http://%s%s" % (unicode(current_site.domain), path)
        context = {
            "user": email_address.user,
            "activate_url": activate_url,
            "current_site": current_site,
            "confirmation_key": confirmation_key,
        }

        send_templated_email([email_address.user], "emails/emailconfirmation",
                             context)

        return self.create(email_address=email_address,
                           sent=now(),
                           confirmation_key=confirmation_key)
示例#9
0
    def deliver(self, recipient, sender, notice_type, extra_context):
        if recipient == sender:
            return False

        context = self.default_context().update({"sender": sender})
        context.update(extra_context)
        send_templated_email([recipient], "emails/%s" % notice_type, context)
        return True
示例#10
0
    def deliver(self, recipient, sender, notice_type, extra_context):
        if recipient == sender:
            return False

        context = self.default_context().update({"sender": sender})
        context.update(extra_context)
        send_templated_email([recipient], "emails/%s" % notice_type, context)
        return True
示例#11
0
def new_feedback(sender, instance, created=False, **kwargs):
    """Send email when new feedback is sent via the feedback button"""
    if created:
        send_templated_email(
            [email for name, email in settings.ADMINS],
            'emails/new_feedback',
            { 'feedback': instance, }
        )
示例#12
0
def index(request):
    if request.POST:
        TO_EMAIL = ["*****@*****.**"]
        nome = request.POST["nome"]
        sender = request.POST["sender"]
        msg = request.POST["msg"]
        send_templated_email(TO_EMAIL, "emails/contato", locals())
        ENVIADO = True

    return locals()
示例#13
0
    def email_to_enquirer(self, form):
        """ Send a confirmation email to the person submitting the form. """
        context = {
            'first_name': unicode(form.cleaned_data['first_name']),
            'message': unicode(form.cleaned_data['message']),
        }

        recipient_email = form.cleaned_data['email']
        send_templated_email([recipient_email], 'emails/juniors_sender',
                             context, from_email='*****@*****.**')
示例#14
0
def index(request):
    if request.POST:
        TO_EMAIL = ['*****@*****.**']
        nome = request.POST['nome']
        sender = request.POST['sender']
        msg = request.POST['msg']
        send_templated_email(TO_EMAIL, 'emails/contato', locals())
        ENVIADO = True

    return locals()
示例#15
0
 def email_group_admins(self, garden, user, membership):
     send_templated_email(
         [admin.email for admin in self.object.admins()],
         'emails/request_gardengroup_membership', {
             'base_url': settings.BASE_URL,
             'garden': garden,
             'group': self.object,
             'membership': membership,
             'user': user,
         }
     )
示例#16
0
 def email_garden_admins(self, garden, membership):
     send_templated_email(
         [admin.email for admin in garden.admins()],
         'emails/gardengroup_invite_garden', {
             'base_url': settings.BASE_URL,
             'garden': garden,
             'group': self.get_object(),
             'membership': membership,
             'user': self.request.user,
         }
     )
示例#17
0
    def send_invite(self, email, garden):
        profile = get_profile(self.request.user)
        if profile.invite_count > settings.MAX_INVITES and not self.request.user.is_staff:
            raise PermissionDenied
        # TODO Tracking *who* invited *whom* could be nice, too
        profile.invite_count += 1
        profile.save()

        send_templated_email(
            [
                email,
            ], 'emails/invite', {
                'base_url': settings.BASE_URL,
                'garden': garden,
                'inviter': self.request.user,
            })
    def deliver(self, recipient, sender, notice_type, extra_context):
        if recipient == sender:
            return False

        context = self.default_context()
        site = Site.objects.get_current()
        context.update({
            "recipient": recipient,
            "sender": sender,
            "site": site,
            "QUALIFIED_URL": "http://%s%s" % (site.domain, settings.STATIC_URL),
            'DOMAIN_URL': 'http://%s' % site.domain
        })
        context.update(extra_context)
        send_templated_email([recipient], "emails/%s" % notice_type, context)
        return True
示例#19
0
    def email_to_enquirer(self, form):
        """ Send a confirmation email to the person submitting the form. """
        context = {
            'first_name': unicode(form.cleaned_data['first_name']),
            'message': unicode(form.cleaned_data['message']),
        }
        try:
            context['secretary_name'] = ClubInfo.objects.get(key='SecretaryName').value
            context['secretary_email'] = ClubInfo.objects.get(key='SecretaryEmail').value
        except ClubInfo.DoesNotExist:
            context['secretary_name'] = ""
            context['secretary_email'] = '*****@*****.**'

        recipient_email = form.cleaned_data['email']
        send_templated_email([recipient_email], 'emails/contact_sender',
                             context, from_email=context['secretary_email'])
示例#20
0
def spark_camp(request):
    form = SparkCampForm(request.POST or None)
    ENVIADO = False

    if form.is_valid():
        TO_EMAIL = ['*****@*****.**']
        nome = form.cleaned_data['nome']
        nome_projeto = form.cleaned_data['nome_projeto']
        url_projeto = form.cleaned_data['url_projeto']
        desc_projeto = form.cleaned_data['desc_projeto']
        time = form.cleaned_data['time']
        email_2 = form.cleaned_data['email']
        celular = form.cleaned_data['celular']
        print locals()
        send_templated_email(TO_EMAIL, 'emails/spark-campus', locals())
        ENVIADO = True
    return locals()
示例#21
0
def send_activation_email(registration_profile, site):
    """
    Send an activation email to the user associated with this
    ``RegistrationProfile``.

    The activation email will make use of two templates:

    ``emails/activation/short.txt``
        This template will be used for the subject line of the
        email. Because it is used as the subject line of an email,
        this template's output **must** be only a single line of
        text; output longer than one line will be forcibly joined
        into only a single line.

    ``emails/activation/email.txt`` / ``emails/activation/email.html``
        This template will be used for the body of the email. Text and
        HTML versions will be provided.

    These templates will each receive the following context
    variables:

    ``activation_key``
        The activation key for the new account.

    ``expiration_days``
        The number of days remaining during which the account may
        be activated.

    ``site``
        An object representing the site on which the user
        registered; depending on whether ``django.contrib.sites``
        is installed, this may be an instance of either
        ``django.contrib.sites.models.Site`` (if the sites
        application is installed) or
        ``django.contrib.sites.models.RequestSite`` (if
        not). Consult the documentation for the Django sites
        framework for details regarding these objects' interfaces.

    """
    context = {'activation_key': registration_profile.activation_key,
               'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
               'site': site,
               'user': registration_profile.user,
               'base_url': "//" + Site.objects.get_current().domain}

    send_templated_email([registration_profile.user.email], 'emails/activation', context)
示例#22
0
def spark_camp(request):
    form = SparkCampForm(request.POST or None)
    ENVIADO = False

    if form.is_valid():
        TO_EMAIL = ["*****@*****.**"]
        nome = form.cleaned_data["nome"]
        nome_projeto = form.cleaned_data["nome_projeto"]
        url_projeto = form.cleaned_data["url_projeto"]
        desc_projeto = form.cleaned_data["desc_projeto"]
        time = form.cleaned_data["time"]
        email_2 = form.cleaned_data["email"]
        celular = form.cleaned_data["celular"]
        print locals()
        send_templated_email(TO_EMAIL, "emails/spark-campus", locals())
        ENVIADO = True
    return locals()
示例#23
0
文件: models.py 项目: HZ-labs/Rynda
def create_new_user(first_name, last_name, password, email):
    user = User(
        first_name=first_name,
        last_name=last_name,
        email=email,
        username=email,
        is_staff=False,
        is_active=False
    )
    user.set_password(password),
    user.save()
    send_templated_email(
        [user], 'emails/registration_confirm',
        {'user': user, 'site_url': 'SERVER_NAME',
         'activation_code': 'code', }
    )
    return user
示例#24
0
    def send_invite(self, email, garden):
        profile = get_profile(self.request.user)
        if profile.invite_count > settings.MAX_INVITES and not self.request.user.is_staff:
            raise PermissionDenied
        # TODO Tracking *who* invited *whom* could be nice, too
        profile.invite_count += 1
        profile.save()

        send_templated_email(
            [email,],
            'emails/invite',
            { 
                'base_url': settings.BASE_URL,
                'garden': garden,
                'inviter': self.request.user,
            }
        )
示例#25
0
def send_welcome_email_to_user(reg_profile, password, sim):
    """ Sends a welcome email to the user (after they've just registered).

        Welcome email will include the activation link the user will need to
        click on to activate their account (and verify their email address).
    """
    context = {
        'activation_key': reg_profile.activation_key,
        'first_name': reg_profile.user.first_name,
        'last_name': reg_profile.user.last_name,
        'email': reg_profile.user.email,
        'password': password,
        'base_url': "//" + Site.objects.get_current().domain
    }
    print 'Emailing {}'.format(reg_profile.user.get_full_name())
    if not sim:
        send_templated_email([reg_profile.user.email], 'emails/account_created', context)
示例#26
0
def new_garden_membership(sender, instance, created=False, **kwargs):
    if created:
        # Try to find admins for this garden that are not the new person
        admins = GardenMembership.objects.filter(
            garden=instance.garden,
            is_admin=True,
        ).exclude(user_profile=instance.user_profile)
        if admins:
            send_templated_email(
                [admin.user_profile.user.email for admin in admins],
                'emails/new_garden_membership',
                {
                    'base_url': settings.BASE_URL,
                    'garden': instance.garden,
                    'new_user': instance.user_profile.user,
                }
            )
示例#27
0
    def email_to_secretary(self, form):
        """ Send an email to the secretary with the form data. """
        email = form.cleaned_data['email']
        LOG.debug("Email = {}".format(email))
        context = {
            'name': u"{} {}".format(form.cleaned_data['first_name'], form.cleaned_data['last_name']),
            'phone': form.cleaned_data['phone'],
            'sender_email': email,
            'join_mail_list': form.cleaned_data['mailing_list'],
            'message': unicode(form.cleaned_data['message']),
        }

        try:
            recipient_email = ClubInfo.objects.get(key='SecretaryEmail').value
        except ClubInfo.DoesNotExist:
            recipient_email = '*****@*****.**'
        send_templated_email([recipient_email], 'emails/contact_secretary',
                             context, from_email=email)
示例#28
0
def send_want_email(vote):
    try:
        s = Subscription.objects.get(idea=vote.idea, user=vote.idea.created_by)
        membership = Member.objects.get(user=vote.idea.created_by,
                                        company=vote.idea.company)
    except:
        return False
    if s.muted or not s.user.user_detail.email_want:
        return False

    if vote.user == vote.idea.created_by:
        return False

    idea_url = ''.join([
        'https://',
        get_current_site(None).domain,
        vote.idea.get_absolute_url()
    ])
    author_url = ''.join([
        'https://',
        get_current_site(None).domain,
        '/' + vote.idea.company.slug + '/member/' + str(vote.user.id) + '/'
    ])

    mute_url = ''.join(
        ['https://',
         get_current_site(None).domain, '/mute/' + s.key + '/'])

    try:
        send_templated_email(
            [s.user.email], "emails/idea_wanted", {
                'vote': vote,
                'first_name': s.user.first_name,
                'idea_url': idea_url,
                'author_url': author_url,
                'user_email': s.user.email,
                'mute_url': mute_url,
                'settings_url': author_url + 'preferences/notifications/',
            }, s.idea.company.title + ' <noreply+' + s.idea.company.slug +
            '@wantoo.io>')
    except:
        print 'send_want_email fail'
        pass
示例#29
0
    def email_to_juniors(self, form):
        """ Send an email to [email protected] with the form data. """
        email = form.cleaned_data['email']
        trigger = form.cleaned_data['trigger']
        triggerText = JuniorsContactSubmission.TRIGGER[trigger] if trigger != JuniorsContactSubmission.TRIGGER.not_selected else None
        LOG.debug("Email = {}".format(email))
        context = {
            'name': u"{} {}".format(form.cleaned_data['first_name'], form.cleaned_data['last_name']),
            'phone': form.cleaned_data['phone'],
            'sender_email': email,
            'child_name': form.cleaned_data['child_name'],
            'child_age': JuniorsContactSubmission.AGE[form.cleaned_data['child_age']],
            'child_gender': JuniorsContactSubmission.GENDER[form.cleaned_data['child_gender']],
            'trigger': triggerText,
            'join_mail_list': form.cleaned_data['mailing_list'],
            'message': unicode(form.cleaned_data['message']),
        }

        recipient_email = '*****@*****.**'
        send_templated_email([recipient_email], 'emails/juniors_report',
                             context, from_email=email)
示例#30
0
def edit_ticket(request, id,  template_name=""):
    ticket = SupportQuestion.objects.get(pk=id)
    if request.POST:
        # check if it is assigned
        if request.POST.get("action")=="assign":
            ticket.accepted_by = User.objects.get(pk=request.POST.get("assign-to"))
            send_templated_email([ticket.accepted_by.email], "emails/support_ticket_assigned", {"ticket": ticket})
            messages.success(request, _("Ticket has been assigned"))
            
        # check if it is closed or reopened
        if request.POST.get("action")=="close":
            ticket.closed = True
            messages.success(request, _("Ticket was closed"))
        
        if request.POST.get("action")=="open":
            ticket.closed = False
            messages.success(request, _("Ticket was reopened"))
        
        # check for reply
        if request.POST.get("action")=="reply":
            message = request.POST.get("message")
            reply = SupportReply(message=message, user=request.user,
                         support_question=ticket)
            reply.save()
            
            email = ticket.email
            if ticket.user:
                email = ticket.user.email
            send_templated_email([email], "emails/support_ticket_reply", {"ticket": ticket,
                                                                     "reply":reply})
            messages.success(request, _("Ticket reply has been sent"))
            
        # save
        ticket.save()
        return HttpResponseRedirect(reverse('support_view_ticket', args=(ticket.pk,)))
        
    return render_to_response(template_name,
                              { 'ticket': ticket },
                              context_instance=RequestContext(request))
示例#31
0
def company(request, company_slug=None):
    """
    Save all initial company options dynamically from /company/ route
    """

    if not request.user.is_authenticated():
        return HttpResponseForbidden()

    #if request.user.user_detail.company is None:

    if request.data.get('title'):
        data = {'title': request.data.get('title')}
        serializer = CompanySerializer(data=data)
        if serializer.is_valid():

            company = Company()
            company.title = data['title']
            company.created_by = request.user
            company.save()

            ########Generating first idea by Wantoobot#########
            try:
                wantoo_bot = User.objects.get(email='*****@*****.**')
            except User.DoesNotExist:
                print 'Wantoobot Does not exists'
                raise

            idea = Idea()

            idea.title = 'This is a Test Idea'
            idea.description = "Welcome to Wantoo! Here's a test idea to help you explore your Idea Board's functionality.\n" \
                                "\nYou can vote for it by hitting the Want button.\n" \
                                "\nEdit this idea by hitting those three little dots next to the title.\n" \
                                "\nComment on it in the field below.\n" \
                                "\nShare this idea with others through Twitter, Facebook, or email via the buttons in the upper right.\n" \
                                "\nWhen you're in Management view, You can drag and drop this idea into different columns to instantly change its category.\n" \
                                "\nOnce you've gotten the hang of it, you can delete it and start adding real ideas of your own."

            idea.company = company
            idea.created_by = wantoo_bot
            idea.new = True
            idea.save()

            #############

            request.user.user_detail.company = company
            request.user.user_detail.save()

            slug = {'slug': company.slug}

            group = Group.objects.create(name=company.slug)
            perm = Permission.objects.get(codename='is_company_admin')
            group.permissions.add(perm)

            #######
            usr_name = request.user.get_full_name()
            usr_email = request.user.email
            usr_url = 'http://wantoo.io/' + company.slug

            try:
                # send_templated_email([usr_email], "emails/sign_up", {
                #     'full_name': usr_name,
                #     'author_url': usr_url,
                # })
                send_templated_email(
                    ['*****@*****.**'], "emails/new_board_admin", {
                        'full_name': usr_name,
                        'author_email': usr_email,
                        'author_url': usr_url,
                    })
            except:
                return Response('Email didnt end...')
            #########

            return Response(json.dumps(slug), status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

    #else:

    company = get_object_or_404(Company, slug=company_slug)

    if not has_admin_permission(request.user, company):
        return HttpResponseForbidden()
    else:

        if request.data.get('logo_url'):
            company.logo_url = request.data.get('logo_url').strip()

        if request.data.get('question'):
            company.question = request.data.get('question').strip()

        if request.data.get('color'):
            company.color = request.data.get('color').strip()

        company.save()
        return Response(status=status.HTTP_200_OK)
示例#32
0
def send_comment_emails(comment):

    subscribers = Subscription.objects.filter(
        idea=comment.idea, muted=False).exclude(user=comment.created_by)
    idea_url = ''.join([
        'https://',
        get_current_site(None).domain,
        comment.idea.get_absolute_url()
    ])
    author_url = ''.join([
        'https://',
        get_current_site(None).domain, '/' + comment.idea.company.slug +
        '/member/' + str(comment.created_by.id) + '/'
    ])

    for s in subscribers:
        membership = Member.objects.get(user=s.user,
                                        company=comment.idea.company)

        #muted idea in email
        if s.muted:
            continue

        #created the idea, and doesn't want emails when comments added
        if s.user == s.idea.created_by and not s.user.user_detail.email_comment:
            continue

        #commented an idea, and doesn't want emails when comments added
        comments = Comment.objects.filter(idea=comment.idea,
                                          created_by=s.user).exists()
        print comments
        if comments and not s.user.user_detail.email_comment_on_comment:
            continue

        #wanted idea, and doesn't want emails when comments added
        votes = Vote.objects.filter(idea=comment.idea, user=s.user).exists()
        print 'votes exists'
        if not (s.user == s.idea.created_by) and votes and (
                not s.user.user_detail.email_comment_on_want):
            continue

        mute_url = ''.join([
            'https://',
            get_current_site(None).domain, '/mute/' + s.key + '/'
        ])
        settings_url = ''.join([
            'https://',
            get_current_site(None).domain, '/' + comment.idea.company.slug +
            '/member/' + str(s.user.id) + '/preferences/notifications/'
        ])

        try:
            send_templated_email(
                [s.user.email], "emails/comment_added", {
                    'comment': comment,
                    'comment_title': unicode(comment.idea.title),
                    'first_name': s.user.first_name,
                    'idea_url': idea_url,
                    'author_url': author_url,
                    'user_email': s.user.email,
                    'mute_url': mute_url,
                    'settings_url': settings_url,
                }, s.idea.company.title + ' <noreply+' + s.idea.company.slug +
                '@wantoo.io>')
        except:
            print 'send_comment_emails fail'
            pass
示例#33
0
文件: models.py 项目: HZ-labs/Rynda
def notify_new_user(user, code):
    send_templated_email(
        [user], 'emails/registration_confirm',
        {'user': user, 'site_url': self.request.META['SERVER_NAME'],
         'activation_code': code, }
    )