Exemple #1
0
def email_technical_partner_declined(user_id):
    try:
        from skyhigh import models

        user = User.objects.get(pk=user_id)

        if user.profile.email_notifications:
            ctx_dict = utils.get_email_context(user)

            ctx_dict.update({
                'display_name': user.profile.display_name,
            })

            configurable_email = models.ConfigurableEmail.objects.get(
                slug='technical-partner-request-declined')

            subject = utils.get_configurable_email_subject(
                configurable_email, ctx_dict)

            text_content = utils.get_configurable_email_text_content(
                configurable_email, ctx_dict)

            html_content = utils.get_configurable_email_html_content(
                configurable_email, ctx_dict)

            utils.send_mail(None,
                            ctx_dict,
                            subject,
                            text_content,
                            settings.DEFAULT_FROM_EMAIL, [user.email] +
                            configurable_email.internal_bcc_list,
                            user=user,
                            html_content=html_content)
    except Exception, exc:
        raise email_technical_partner_declined.retry(exc=exc)
Exemple #2
0
def email_successful_account_activation(user_id):
    try:
        from skyhigh import models
        
        user = User.objects.get(pk=user_id)
    
        ctx_dict = utils.get_email_context(user)
    
        ctx_dict.update({'uid': int_to_base36(user.id),
                         'token': default_token_generator.make_token(user),
                         'display_name': user.profile.display_name,
                         'username': user.username})
        
        configurable_email = models.ConfigurableEmail.objects.get(slug='successful-account-activation')
    
        subject = utils.get_configurable_email_subject(configurable_email, ctx_dict)
        
        text_content = utils.get_configurable_email_text_content(configurable_email, ctx_dict)
        
        html_content = utils.get_configurable_email_html_content(configurable_email, ctx_dict)
    
        utils.send_mail(None, ctx_dict, subject, text_content, settings.DEFAULT_FROM_EMAIL, 
                        [user.email] + configurable_email.internal_bcc_list, user=user, html_content=html_content)
    except Exception, exc:
        raise email_successful_account_activation.retry(exc=exc)
Exemple #3
0
def email_account_reactivation(registration_profile_id, site_id):
    try:
        from skyhigh import models
        registration_profile = models.SkyHighRegistrationProfile.objects.get(pk=registration_profile_id)
        site = Site.objects.get(pk=site_id)
        
        ctx_dict = {'user' : registration_profile.user,
                    'activation_key': registration_profile.activation_key,
                    'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
                    'site': site,
                    'app_name': settings.APP_NAME,
                    'display_name': registration_profile.user.profile.display_name,
                    'username': registration_profile.user.username}
        
        # Email subject *must not* contain newlines
        configurable_email = models.ConfigurableEmail.objects.get(slug='account-reactivation')
        
        subject = utils.get_configurable_email_subject(configurable_email, ctx_dict)
        
        text_content = utils.get_configurable_email_text_content(configurable_email, ctx_dict)
        
        html_content = utils.get_configurable_email_html_content(configurable_email, ctx_dict)
        
        utils.send_mail(None, ctx_dict, subject, text_content, settings.DEFAULT_FROM_EMAIL, 
                        [registration_profile.user.email] + configurable_email.internal_bcc_list, html_content=html_content)
    except Exception, exc:
        raise email_account_reactivation.retry(exc=exc)
Exemple #4
0
def email_account_reactivation(registration_profile_id, site_id):
    try:
        from skyhigh import models
        registration_profile = models.SkyHighRegistrationProfile.objects.get(
            pk=registration_profile_id)
        site = Site.objects.get(pk=site_id)

        ctx_dict = {
            'user': registration_profile.user,
            'activation_key': registration_profile.activation_key,
            'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
            'site': site,
            'app_name': settings.APP_NAME,
            'display_name': registration_profile.user.profile.display_name,
            'username': registration_profile.user.username
        }

        # Email subject *must not* contain newlines
        configurable_email = models.ConfigurableEmail.objects.get(
            slug='account-reactivation')

        subject = utils.get_configurable_email_subject(configurable_email,
                                                       ctx_dict)

        text_content = utils.get_configurable_email_text_content(
            configurable_email, ctx_dict)

        html_content = utils.get_configurable_email_html_content(
            configurable_email, ctx_dict)

        utils.send_mail(None,
                        ctx_dict,
                        subject,
                        text_content,
                        settings.DEFAULT_FROM_EMAIL,
                        [registration_profile.user.email] +
                        configurable_email.internal_bcc_list,
                        html_content=html_content)
    except Exception, exc:
        raise email_account_reactivation.retry(exc=exc)
Exemple #5
0
def email_technical_partner_declined(user_id):
    try:
        from skyhigh import models
        
        user = User.objects.get(pk=user_id)
    
        if user.profile.email_notifications:
            ctx_dict = utils.get_email_context(user)
            
            ctx_dict.update({'display_name': user.profile.display_name,})
            
            configurable_email = models.ConfigurableEmail.objects.get(slug='technical-partner-request-declined')
        
            subject = utils.get_configurable_email_subject(configurable_email, ctx_dict)
        
            text_content = utils.get_configurable_email_text_content(configurable_email, ctx_dict)
            
            html_content = utils.get_configurable_email_html_content(configurable_email, ctx_dict)
        
            utils.send_mail(None, ctx_dict, subject, text_content, settings.DEFAULT_FROM_EMAIL, 
                            [user.email] + configurable_email.internal_bcc_list, user=user, html_content=html_content)
    except Exception, exc:
        raise email_technical_partner_declined.retry(exc=exc)
Exemple #6
0
def email_existing_csp_activation(user_id):
    try:
        from skyhigh import models

        user = User.objects.get(pk=user_id)

        ctx_dict = utils.get_email_context(user)

        ctx_dict.update({
            'uid': int_to_base36(user.id),
            'token': default_token_generator.make_token(user),
            'display_name': user.profile.display_name,
            'username': user.username
        })

        configurable_email = models.ConfigurableEmail.objects.get(
            slug='existing-csp-activation')

        subject = utils.get_configurable_email_subject(configurable_email,
                                                       ctx_dict)

        text_content = utils.get_configurable_email_text_content(
            configurable_email, ctx_dict)

        html_content = utils.get_configurable_email_html_content(
            configurable_email, ctx_dict)

        utils.send_mail(None,
                        ctx_dict,
                        subject,
                        text_content,
                        settings.DEFAULT_FROM_EMAIL,
                        [user.email] + configurable_email.internal_bcc_list,
                        user=user,
                        html_content=html_content)
    except Exception, exc:
        raise email_existing_csp_activation.retry(exc=exc)