예제 #1
0
    def post(self):
        logging.info('RenewMemberMailWorker hit')
        logging.info(self.request.params.items())

        #
        # Send welcome email
        #

        member_name = '%s %s' % (self.request.POST[config.MEMBER_FIELDS.first_name.name],
                                 self.request.POST[config.MEMBER_FIELDS.last_name.name])
        member_email = self.request.POST[config.MEMBER_FIELDS.email.name]

        with open('templates/tasks/email-renew-member-subject.txt', 'r') as subject_file:
            subject = subject_file.read().strip()

        template_values = {
            'config': config,
        }
        template = JINJA_ENVIRONMENT.get_template('tasks/email-renew-member.jinja')
        body_html = template.render(template_values)

        gapps.send_email(member_email,
                         member_name,
                         subject,
                         body_html)
예제 #2
0
    def post(self):
        logging.info('RenewMemberMailWorker hit')
        logging.info(self.request.params.items())

        #
        # Send welcome email
        #

        member_name = '%s %s' % (
            self.request.POST[config.MEMBER_FIELDS.first_name.name],
            self.request.POST[config.MEMBER_FIELDS.last_name.name])
        member_email = self.request.POST[config.MEMBER_FIELDS.email.name]

        with open('templates/tasks/email-renew-member-subject.txt',
                  'r') as subject_file:
            subject = subject_file.read().strip()

        template_values = {
            'config': config,
        }
        template = JINJA_ENVIRONMENT.get_template(
            'tasks/email-renew-member.jinja')
        body_html = template.render(template_values)

        gapps.send_email(member_email, member_name, subject, body_html)
예제 #3
0
    def post(self):
        logging.info('NewMemberMailWorker hit')
        logging.info(self.request.params.items())

        #
        # Send welcome email
        #

        member_name = '%s %s' % (
            self.request.POST[config.MEMBER_FIELDS.first_name.name],
            self.request.POST[config.MEMBER_FIELDS.last_name.name])
        member_email = self.request.POST[config.MEMBER_FIELDS.email.name]

        with open('templates/tasks/email-new-member-subject.txt',
                  'r') as subject_file:
            subject = subject_file.read().strip()

        template_values = {
            'config': config,
        }
        template = JINJA_ENVIRONMENT.get_template(
            'tasks/email-new-member.jinja')
        body_html = template.render(template_values)

        gapps.send_email(member_email, member_name, subject, body_html)

        #
        # Send email to volunteer-interest-area reps
        #

        interest_reps = gapps.get_volunteer_interest_reps_for_member(
            self.request.POST)

        if interest_reps:
            template = JINJA_ENVIRONMENT.get_template(
                'tasks/email-volunteer-interest-rep-subject.jinja')
            subject = template.render({'join_type': 'member'})
            subject = subject.strip()

            for interest, reps in interest_reps.items():
                template_values = {
                    'interest': interest,
                    'member_name': member_name,
                    'member_email': member_email,
                    'join_type': 'member',
                    'config': config,
                }
                template = JINJA_ENVIRONMENT.get_template(
                    'tasks/email-volunteer-interest-rep.jinja')
                body_html = template.render(template_values)

                for rep in reps:
                    gapps.send_email(
                        rep.get(config.VOLUNTEER_INTEREST_FIELDS.email.name),
                        rep.get(config.VOLUNTEER_INTEREST_FIELDS.name.name),
                        subject, body_html)
예제 #4
0
    def get(self):
        logging.debug('RenewalReminderEmailsWorker hit')

        expiring_entries = gapps.get_members_expiring_soon()
        if not expiring_entries:
            logging.debug('no expiring members')
            return

        logging.debug([x.to_dict() for x in expiring_entries])

        template_values = {
            'config': config,
        }

        with open('templates/tasks/email-renewal-reminder-subject.txt',
                  'r') as subject_file:
            subject_noauto = subject_file.read().strip()
        template_noauto = JINJA_ENVIRONMENT.get_template(
            'tasks/email-renewal-reminder.jinja')

        with open('templates/tasks/email-renewal-reminder-auto-subject.txt',
                  'r') as subject_file:
            subject_auto = subject_file.read().strip()
        template_auto = JINJA_ENVIRONMENT.get_template(
            'tasks/email-renewal-reminder-auto.jinja')

        for entry in expiring_entries:
            entry_dict = entry.to_dict()

            template_values['member_first_name'] = entry_dict.get(
                config.MEMBER_FIELDS.first_name.name)
            body_html_noauto = template_noauto.render(template_values)
            body_html_auto = template_auto.render(template_values)

            member_name = '%s %s' % (
                entry_dict.get(config.MEMBER_FIELDS.first_name.name),
                entry_dict.get(config.MEMBER_FIELDS.last_name.name))
            member_email = entry_dict.get(config.MEMBER_FIELDS.email.name)

            # Right now we use a Paypal button that does one-time purchases;
            # that is, members pay for a year and then need to manually pay
            # again the next year. But previously we used a "subscription"
            # Paypal button, so there are still some members who automatically
            # pay each year. These two groups will get different reminder
            # emails.
            auto_renewing = str(
                entry_dict.get(config.MEMBER_FIELDS.paypal_auto_renewing.name))
            if auto_renewing.lower().startswith('y'):
                # Member is auto-renewing (i.e., is a Paypal "subscriber")
                gapps.send_email(member_email, member_name, subject_auto,
                                 body_html_auto)
            else:
                # Member is year-to-year
                gapps.send_email(member_email, member_name, subject_noauto,
                                 body_html_noauto)
예제 #5
0
    def post(self):
        logging.info('NewMemberMailWorker hit')
        logging.info(self.request.params.items())

        #
        # Send welcome email
        #

        member_name = '%s %s' % (self.request.POST[config.MEMBER_FIELDS.first_name.name],
                                 self.request.POST[config.MEMBER_FIELDS.last_name.name])
        member_email = self.request.POST[config.MEMBER_FIELDS.email.name]

        with open('templates/tasks/email-new-member-subject.txt', 'r') as subject_file:
            subject = subject_file.read().strip()

        template_values = {
            'config': config,
        }
        template = JINJA_ENVIRONMENT.get_template('tasks/email-new-member.jinja')
        body_html = template.render(template_values)

        gapps.send_email(member_email,
                         member_name,
                         subject,
                         body_html)

        #
        # Send email to volunteer-interest-area reps
        #

        interest_reps = gapps.get_volunteer_interest_reps_for_member(self.request.POST)

        if interest_reps:
            template = JINJA_ENVIRONMENT.get_template('tasks/email-volunteer-interest-rep-subject.jinja')
            subject = template.render({'join_type': 'member'})
            subject = subject.strip()

            for interest, reps in interest_reps.items():
                template_values = {
                    'interest': interest,
                    'member_name': member_name,
                    'member_email': member_email,
                    'join_type': 'member',
                    'config': config,
                }
                template = JINJA_ENVIRONMENT.get_template('tasks/email-volunteer-interest-rep.jinja')
                body_html = template.render(template_values)

                for rep in reps:
                    gapps.send_email(rep.get(config.VOLUNTEER_INTEREST_FIELDS.email.name),
                                     rep.get(config.VOLUNTEER_INTEREST_FIELDS.name.name),
                                     subject,
                                     body_html)
예제 #6
0
    def get(self):
        logging.debug('RenewalReminderEmailsWorker hit')

        expiring_entries = gapps.get_members_expiring_soon()
        if not expiring_entries:
            logging.debug('no expiring members')
            return

        logging.debug([x.to_dict() for x in expiring_entries])

        template_values = {
            'config': config,
        }

        with open('templates/tasks/email-renewal-reminder-subject.txt', 'r') as subject_file:
            subject_noauto = subject_file.read().strip()
        template_noauto = JINJA_ENVIRONMENT.get_template('tasks/email-renewal-reminder.jinja')

        with open('templates/tasks/email-renewal-reminder-auto-subject.txt', 'r') as subject_file:
            subject_auto = subject_file.read().strip()
        template_auto = JINJA_ENVIRONMENT.get_template('tasks/email-renewal-reminder-auto.jinja')

        for entry in expiring_entries:
            entry_dict = entry.to_dict()

            template_values['member_first_name'] = entry_dict.get(config.MEMBER_FIELDS.first_name.name)
            body_html_noauto = template_noauto.render(template_values)
            body_html_auto = template_auto.render(template_values)

            member_name = '%s %s' % (entry_dict.get(config.MEMBER_FIELDS.first_name.name),
                                     entry_dict.get(config.MEMBER_FIELDS.last_name.name))
            member_email = entry_dict.get(config.MEMBER_FIELDS.email.name)

            # Right now we use a Paypal button that does one-time purchases;
            # that is, members pay for a year and then need to manually pay
            # again the next year. But previously we used a "subscription"
            # Paypal button, so there are still some members who automatically
            # pay each year. These two groups will get different reminder
            # emails.
            auto_renewing = str(entry_dict.get(config.MEMBER_FIELDS.paypal_auto_renewing.name))
            if auto_renewing.lower().startswith('y'):
                # Member is auto-renewing (i.e., is a Paypal "subscriber")
                gapps.send_email(member_email,
                                 member_name,
                                 subject_auto,
                                 body_html_auto)
            else:
                # Member is year-to-year
                gapps.send_email(member_email,
                                 member_name,
                                 subject_noauto,
                                 body_html_noauto)