Ejemplo n.º 1
0
def email_account_activation(registration_profile_id, site_id):
    try:
        from app.authentication import models
        registration_profile = models.ProjectRegistrationProfile.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
        }
        
        print registration_profile.user.email
        
        mailer_utils.send_mail(
            subject='email/subjects/activation_email_subject.txt', 
            html_content='email/html/activation_email.html', 
            text_content='email/txt/activation_email.txt', 
            context=ctx_dict,
            to_addresses=[registration_profile.user.email,],
            user=registration_profile.user
        )
    except Exception, exc:
        raise email_account_activation.retry(exc=exc)
Ejemplo n.º 2
0
def email_contact_message(contact_message_id):
    """
    Sends a Contact Message email to the Site's owners/support team

    """
    try:
        from tunobase.corporate.company_info.contact import models

        contact_message = models.ContactMessage.objects.get(
            pk=contact_message_id
        )
        user = contact_message.user

        ctx_dict = {
            'contact_message' : contact_message,
        }

        mailer_utils.send_mail(
            subject='email/subjects/contact_message_subject.txt',
            html_content='email/html/contact_message.html',
            text_content='email/txt/contact_message.txt',
            context=ctx_dict,
            from_address=contact_message.email or settings.CONTACT_MESSAGE_TO_EMAIL,
            to_addresses=[settings.CONTACT_MESSAGE_TO_EMAIL,],
            user=user
        )
    except Exception, exc:
        raise email_contact_message.retry(exc=exc)
Ejemplo n.º 3
0
 def handle(self, *args, **options):
     email_address = args[0]
     print 'Sending test email to: %s' % email_address
     mailer_utils.send_mail(
         'Test message',
         'Test message',
         [email_address],
         settings.DEFAULT_FROM_EMAIL,
         html_content='Test Message'
     )
Ejemplo n.º 4
0
def email_venue_hire(context):
    try:
        admin_emails = (settings.CONTACT_MESSAGE_TO_EMAIL, )
        mailer_utils.send_mail(
            subject='email/subjects/venue_hire_email_subject.txt',
            html_content='email/html/venue_hire_email.html',
            text_content='email/txt/venue_hire_email.txt',
            context=context,
            to_addresses=admin_emails,
        )
    except Exception, exc:
        raise email_venue_hire.retry(exc=exc)
Ejemplo n.º 5
0
def email_venue_hire(context):
    try:
        admin_emails = (settings.CONTACT_MESSAGE_TO_EMAIL, )
        mailer_utils.send_mail(
            subject='email/subjects/venue_hire_email_subject.txt',
            html_content='email/html/venue_hire_email.html',
            text_content='email/txt/venue_hire_email.txt',
            context=context,
            to_addresses=admin_emails,
        )
    except Exception, exc:
        raise email_venue_hire.retry(exc=exc)
Ejemplo n.º 6
0
def email_password_reset(context):
    try:
        user = get_user_model().objects.get(pk=context['user_id'])

        mailer_utils.send_mail(
            subject='email/subjects/password_reset_email_subject.txt',
            html_content='email/html/password_reset_email.html',
            text_content='email/txt/password_reset_email.txt',
            context=context,
            to_addresses=[user.email, ],
            user=user
        )
    except Exception, exc:
        raise email_password_reset.retry(exc=exc)
Ejemplo n.º 7
0
def email_password_reset(context):
    try:
        user = get_user_model().objects.get(pk=context['user_id'])

        mailer_utils.send_mail(
            subject='email/subjects/password_reset_email_subject.txt',
            html_content='email/html/password_reset_email.html',
            text_content='email/txt/password_reset_email.txt',
            context=context,
            to_addresses=[
                user.email,
            ],
            user=user)
    except Exception, exc:
        raise email_password_reset.retry(exc=exc)
Ejemplo n.º 8
0
def email_account_post_activation(user_id):
    try:
        activated_user = get_user_model().objects.get(pk=user_id)
        context = {'user': activated_user, 'app_name': settings.APP_NAME}

        mailer_utils.send_mail(
            subject='Copy for basic membership application',
            html_content='email/html/post_activation_email.html',
            text_content='email/txt/post_activation_email.txt',
            context=context,
            to_addresses=[
                activated_user.email,
            ],
            user=activated_user)
    except Exception, exc:
        raise email_account_post_activation.retry(exc=exc)
Ejemplo n.º 9
0
def email_account_post_activation(user_id):
    try:
        activated_user = get_user_model().objects.get(pk=user_id)
        context = {
            'user': activated_user,
            'app_name': settings.APP_NAME
        }

        mailer_utils.send_mail(
            subject='Copy for basic membership application',
            html_content='email/html/post_activation_email.html',
            text_content='email/txt/post_activation_email.txt',
            context=context,
            to_addresses=[activated_user.email, ],
            user=activated_user
        )
    except Exception, exc:
        raise email_account_post_activation.retry(exc=exc)
Ejemplo n.º 10
0
def email_account_activation(registration_profile_id, site_id):
    try:
        from app.authentication import models
        registration_profile = models.ProjectRegistrationProfile.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
        }

        mailer_utils.send_mail(
            subject='email/subjects/activation_email_subject.txt',
            html_content='email/html/activation_email.html',
            text_content='email/txt/activation_email.txt',
            context=ctx_dict,
            to_addresses=[
                registration_profile.user.email,
            ],
            user=registration_profile.user)

        admin_emails = (settings.CONTACT_MESSAGE_TO_EMAIL, )
        mailer_utils.send_mail(
            subject='Jozihub - New User',
            text_content='email/txt/activation_email_to_admin.txt',
            html_content='email/html/activation_email_to_admin.html',
            context={
                'user': registration_profile.user,
                'site': site,
                'app_name': settings.APP_NAME
            },
            to_addresses=admin_emails,
            from_address=registration_profile.user.email,
        )
    except Exception, exc:
        raise email_account_activation.retry(exc=exc)