def run(self):
        choices = [
            (event.id, event.name)
            for event in Event.query.filter_by(active=True).order_by(Event.start_on.desc()).all()
        ]

        event_id = prompt_choices("Select your event", choices=choices, resolve=int, default=choices[-1][0])

        event = Event.query.get(event_id)
        if not event:
            print "There is no event, we stop the procedure"
            return

        users = set()
        for talk in event.validated_talks:

            users.add(talk.user)

        with mail.connect() as conn:
            for user in users:
                msg = mail_message(
                    _('Relevant Information'),
                    recipients=[user.email],
                    templates={'txt': 'emails/last_email_for_speaker.txt'},
                    values=dict(user=user)
                )
                conn.send(msg)
    def run(self):
        choices = [
            (event.id, event.name)
            for event in Event.query.filter_by(active=True).order_by(Event.start_on.desc()).all()
        ]

        event_id = prompt_choices("Select your event", choices=choices, resolve=int, default=choices[-1][0])

        event = Event.query.get(event_id)
        if not event:
            print "There is no event, we stop the procedure"
            return

        import collections
        users = collections.defaultdict(list)
        for talk in event.validated_talks:
            users[talk.user].append(TalkPresenter(talk))

        with mail.connect() as conn:
            for user, talks in users.iteritems():
                print user.name, user.email
                msg = mail_message(
                    _('Update of the schedule'),
                    recipients=[user.email],
                    templates={'txt': 'emails/update_schedule.txt'},
                    values=dict(user=user, talks=talks)
                )
                conn.send(msg)
    def run(self, validated=False, declined=False, backup=False):
        choices = [
            (event.id, event.name)
            for event in Event.query.filter_by(active=True).order_by(Event.start_on.desc()).all()
        ]

        event_id = prompt_choices("Select your event", choices=choices, resolve=int, default=choices[-1][0])

        event = Event.query.get(event_id)
        if not event:
            print "There is no event, we stop the procedure"
            return

        with mail.connect() as conn:
            for idx, talk in enumerate(event.talks):
                values = dict(talk=TalkPresenter(talk))

                msg = None
                if declined and talk.state == 'declined':
                    msg = mail_message(
                        _('Your talk has been declined!'),
                        recipients=[talk.user.email],
                        templates={'txt': 'emails/talk_declined.txt'},
                        values=values
                    )

                if validated and talk.state == 'validated' and not talk.is_backup:
                    msg = mail_message(
                        _('Congratulations, your talk has been accepted!'),
                        recipients=[talk.user.email],
                        templates={'txt': 'emails/talk_accepted.txt'},
                        values=values
                    )

                if backup and talk.state == 'validated' and talk.is_backup:
                    msg = mail_message(
                        _('Your talk has been accepted for a Backup!'),
                        recipients=[talk.user.email],
                        templates={'txt': 'emails/talk_accepted_backup.txt'},
                        values=values
                    )

                if msg:
                    print msg
                    conn.send(msg)
Example #4
0
 def run(self):
     with mail.connect() as conn:
         for user in User.query.order_by(User.name).all():
             if not user.is_speaker:
                 continue
             msg = mail_message(
                 _('Information and Questions'),
                 recipients=[user.email],
                 templates={'txt': 'emails/speaker_email.txt'},
                 values=dict(user=user)
             )
             conn.send(msg)
Example #5
0
 def run(self):
     with mail.connect() as conn:
         users = set(talk.user for talk in Talk.query.all())
         sorted_users = sorted(users, key=operator.attrgetter('name'))
         for user in sorted_users:
             print user.name, user.email
             msg = mail_message(
                 _('Call For Proposals'),
                 recipients=[user.email],
                 templates={'txt': 'emails/cfp_invitation.txt'},
                 values=dict(user=user)
             )
             conn.send(msg)
    def run(self, emails):
        emails = set(emails)
        users = User.query.filter(User.email.in_(emails)).all()

        if len(emails) != len(users):
            print "There is a wrong email"
            return

        with mail.connect() as conn:
            for user in users:
                msg = mail_message(
                    _('Create an account on Pentabarf'),
                    recipients=[user.email],
                    templates={'txt': 'emails/create_account_pentabarf.txt'},
                    values=dict(user=user),
                )
                conn.send(msg)
Example #7
0
    def run(self):
        with mail.connect() as conn:
            for talk in Talk.query.filter_by(state='validated'):
                values = {
                    'url_talk': external_url_for('general.talk_show',
                                                 record_id=talk.id,
                                                 slug=talk.slug),
                    'speaker': talk.user.name,
                    'talk_name': talk.name,
                    'talk_description': talk.description,
                    'talk': talk,
                }

                msg = mail_message(
                    _('Your talk has been accepted !'),
                    recipients=[talk.user.email],
                    templates={'txt': 'emails/talk_accepted.txt'},
                    values=values
                )

                conn.send(msg)
    def run(self):
        choices = [
            (event.id, event.name)
            for event in Event.query.filter_by(active=True).order_by(Event.start_on.desc()).all()
        ]

        event_id = prompt_choices("Select your event", choices=choices, resolve=int, default=choices[-1][0])

        event = Event.query.get(event_id)
        if not event:
            print "There is no event, we stop the procedure"
            return

        talk = event.validated_talks[0]
        values = dict(talk=TalkPresenter(talk))
        msg = mail_message(
            _('Congratulations, your talk has been accepted!'),
            recipients=[talk.user.email],
            templates={'txt': 'emails/talk_accepted.txt'},
            values=values
        )
        print msg