コード例 #1
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_invite_indexer(book, index, email_text, sender, attachment):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {
        'base_url':
        models.Setting.objects.get(group__name='general',
                                   name='base_url').value,
        'submission':
        book,
        'index':
        index,
        'sender':
        sender,
    }

    email.send_email(
        get_setting('indexing_request_subject', 'email_subject',
                    'Indexing Request'),
        context,
        from_email.value,
        index.indexer.email,
        email_text,
        book=book,
        attachment=attachment,
        kind='index',
    )
コード例 #2
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_author_invite(
    submission,
    copyedit,
    email_text,
    sender,
    attachment=None,
):
    from_email = models.Setting.objects.get(group__name='email',
                                            name='from_address')

    context = {
        'base_url':
        models.Setting.objects.get(group__name='general',
                                   name='base_url').value,
        'submission':
        submission,
        'copyedit':
        copyedit,
        'sender':
        sender,
    }
    subject = get_setting('copyediting_completed_subject', 'email_subject',
                          'Copyediting Completed')
    email.send_email(
        subject,
        context,
        from_email.value,
        submission.owner.email,
        email_text,
        book=submission,
        attachment=attachment,
        kind='copyedit',
    )
コード例 #3
0
 def handle(self, *args, **options):
     for student in Student.objects.visible():
         try:
             PdfFileReader(file("%s%s" % (s.MEDIA_ROOT, str(student.resume)), "rb"),)
         except Exception as e:
             try:
                 student.deactivate()
                 
                 managers = [mail_tuple[1] for mail_tuple in s.MANAGERS]
                 
                 context = Context({
                     'student_first_name': student.first_name,
                     'student_last_name': student.last_name,
                     'student_email': student.user.email
                 })
                 context.update(get_basic_email_context())
                 
                 subject = ''.join(render_to_string('email_admin_subject.txt', {
                     'message': "Faulty resume"
                 }, context).splitlines())
 
                 body = render_to_string('faulty_resume_email_body.txt', context)
         
                 send_email(subject, body, managers)
             except Exception as e:
                 print e
コード例 #4
0
    def save(self,
             domain_override=None,
             email_template_name='registration/password_reset_email.html',
             use_https=False,
             token_generator=default_token_generator,
             from_email=None,
             request=None):
        """
        Generates a one-use only link for resetting password and sends to the user
        """
        for user in self.users_cache:
            html_email_template_name = email_template_name
            text_email_template_name = 'password_reset_email.txt'
            text_email_body_template = loader.get_template(
                text_email_template_name)
            html_email_body_template = loader.get_template(
                html_email_template_name)

            context = Context({
                'email': user.email,
                'uid': int_to_base36(user.id),
                'first_name': user.first_name,
                'token': token_generator.make_token(user),
            })
            context.update(get_basic_email_context())

            subject = ''.join(
                render_to_string('email_subject.txt', {
                    'message': "Password Reset"
                }, context).splitlines())

            text_email_body = text_email_body_template.render(Context(context))
            html_email_body = html_email_body_template.render(Context(context))

            send_email(subject, text_email_body, [user.email], html_email_body)
コード例 #5
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_invite_typesetter(book, typeset, email_text, sender, attachment=None):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {
        'base_url':
        models.Setting.objects.get(
            group__name='general',
            name='base_url',
        ).value,
        'submission':
        typeset.book,
        'typeset':
        typeset,
        'sender':
        sender,
    }

    email.send_email(
        get_setting('typesetting_subject', 'email_subject', 'Typesetting'),
        context,
        from_email.value,
        typeset.typesetter.email,
        email_text,
        book=book,
        attachment=attachment,
        kind='typeset',
    )
コード例 #6
0
ファイル: views.py プロジェクト: ubiquitypress/statpage
def new_subscriber(request):

	form = forms.NewSub()

	if request.POST:
		form = forms.NewSub(request.POST)
		if form.is_valid():
			new_sub = form.save(commit=False)
			new_sub.confirmation_code = uuid4()
			new_sub.save()

			email_context = {
				'subscriber': new_sub,
				'settings': settings,
				'accept_url': '%s/dashboard/subscribe/%s/accept/' % (settings.BASE_URL, new_sub.confirmation_code),
				'decline_url': '%s/dashboard/subscribe/%s/decline/' % (settings.BASE_URL, new_sub.confirmation_code),
			}

			email.send_email(new_sub.email_address, 'Status Subscription', email_context, 'email_subscribe.html')
			messages.add_message(request, messages.SUCCESS, 'You are now subscribed to notifications.')

			return redirect(reverse('dashboard_index'))

	template = 'dashboard/new_subscriber.html'
	context = {
		'form': form,
	}
	return render(request, template, context)
コード例 #7
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_proposal_revisions(proposal, email_text, sender):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {
        'base_url':
        models.Setting.objects.get(
            group__name='general',
            name='base_url',
        ).value,
        'proposal':
        proposal,
        'sender':
        sender,
    }

    email.send_email(
        get_setting('proposal_revision_required_subject', 'email_subject',
                    '[abp] Proposal Revisions Required'),
        context,
        from_email.value,
        proposal.owner.email,
        email_text,
        kind='proposal',
    )
コード例 #8
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_author_sign_off(submission, email_text, sender):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {
        'base_url':
        models.Setting.objects.get(
            group__name='general',
            name='base_url',
        ).value,
        'submission':
        submission,
        'sender':
        sender,
    }

    email.send_email(
        get_setting('book_contract_uploaded_subject', 'email_subject',
                    'Book Contract Uploaded'),
        context,
        from_email.value,
        submission.owner.email,
        email_text,
        book=submission,
        kind='submission',
    )
コード例 #9
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_proposal_accept(
    proposal,
    email_text,
    submission,
    sender,
    attachment=None,
):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {
        'base_url':
        models.Setting.objects.get(group__name='general',
                                   name='base_url').value,
        'proposal':
        proposal,
        'submission':
        submission,
        'sender':
        sender,
    }

    email.send_email(
        get_setting('proposal_accepted_subject', 'email_subject',
                    '[abp] Proposal Accepted'),
        context,
        from_email.value,
        proposal.owner.email,
        email_text,
        book=submission,
        attachment=attachment,
    )
コード例 #10
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_editorial_review_update(
    book,
    review_assignment,
    email_text,
    sender,
    attachment=None,
):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {'book': book, 'review': review_assignment, 'sender': sender}

    for editor in review_assignment.editorial_board.all():
        email.send_email(
            get_setting('editorial_review_due_date_subject', 'email_subject',
                        'Editorial Review Assignment {}: Due Date Updated') %
            review_assignment.id,
            context,
            from_email.value,
            editor.email,
            email_text,
            book=book,
            attachment=attachment,
            kind='review',
        )
コード例 #11
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_new_user_ack(submission, email_text, new_user, code):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )

    context = {
        'base_url':
        models.Setting.objects.get(
            group__name='general',
            name='base_url',
        ).value,
        'user':
        new_user,
        'code':
        code,
        'submission':
        submission,
    }

    email.send_email(
        get_setting('new_user_subject', 'email_subject',
                    'New User : Profile Details'),
        context,
        from_email.value,
        new_user.email,
        email_text,
        book=submission,
        kind='general',
    )
コード例 #12
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_acknowldgement_email(book, press_editors):
    from_email = core_models.Setting.objects.get(group__name='email', name='from_address').value
    author_text = core_models.Setting.objects.get(group__name='email', name='author_submission_ack').value
    editor_text = core_models.Setting.objects.get(group__name='email', name='editor_submission_ack').value
    press_name = core_models.Setting.objects.get(group__name='general', name='press_name').value

    try:
        principal_contact_name = models.Setting.objects.get(group__name='general', name='primary_contact_name').value
    except:
        principal_contact_name = None

    context = {
        'base_url': core_models.Setting.objects.get(group__name='general', name='base_url').value,
        'submission': book,
        'press_name':press_name,
        'principal_contact_name': principal_contact_name,
    }

    email.send_email(get_setting('submission_ack_subject','email_subject','Submission Acknowledgement'), context, from_email, book.owner.email, author_text, book=book, kind = 'submission')

    if len(press_editors) > 1:
        editor = press_editors[0]
        cc_eds = [editor.email for editor in press_editors if not editor == press_editors[0]]
    else:
        editor = press_editors[0]
        cc_eds = None
    email.send_email(get_setting('new_submission_subject','email_subject','New Submission'), context, from_email, editor.email, editor_text, book=book, cc=cc_eds, kind = 'submission') 

    for editor in press_editors:
        notification = core_models.Task(book=book, assignee=editor, creator=press_editors[0], text='A new submission, {0}, has been made.'.format(book.title), workflow='review')
        notification.save()
コード例 #13
0
ファイル: views.py プロジェクト: maleroy1709/happyschool
def send_emails(appel):
    context = {'appel': appel}
    image = []
    name = appel.name
    if appel.is_student:
        student = People().get_student_by_id(appel.matricule.matricule)
        name = str(student)
        context['etudiant'] = student
        if check_student_photo(student, copy=False):
            image = [
                static("/photos/" + str(appel.matricule.matricule) + ".jpg")
            ]
        else:
            image = [static("/photos/unknown.jpg")]

    sent_to = list(
        filter(lambda e: e != '*****@*****.**',
               map(lambda e: e.email, appel.emails.all())))
    if appel.custom_email:
        sent_to.append(appel.custom_email)
    if not settings.DEBUG:
        email.send_email(to=sent_to,
                         subject="[Appel] %s" % name,
                         email_template="appels/email.html",
                         context=context,
                         images=image)
    else:
        print(sent_to)
        email.send_email(to=[settings.EMAIL_ADMIN],
                         subject="[Appel] %s" % name,
                         email_template="appels/email.html",
                         context=context,
                         images=image)
コード例 #14
0
ファイル: views.py プロジェクト: Dpetters/Umeqo
def student_create_campus_org(request, form_class=CreateCampusOrganizationForm, extra_context=None):
    if request.method == 'POST':
        form = form_class(data=request.POST)
        if form.is_valid():
            new_campus_org = form.save()
            recipients = [mail_tuple[1] for mail_tuple in s.MANAGERS]
            
            context = Context({'first_name':request.user.student.first_name, \
                               'last_name':request.user.student.last_name, \
                               'email':request.user.email, \
                               'new_campus_org':new_campus_org})
            context.update(get_basic_email_context())
            
            txt_email_body = render_to_string('new_campus_org_email_body.txt', context)
            
            subject = ''.join(render_to_string('email_admin_subject.txt', {
                'message': "New Campus Org: %s" % new_campus_org
            }, context).splitlines())

            send_email(subject, txt_email_body, recipients)
            
            data = {"type": new_campus_org.type.name,
                    "name": new_campus_org.name,
                    "id": new_campus_org.id}
        else:
            data = {'errors': form.errors }
        return HttpResponse(simplejson.dumps(data), mimetype="application/json")
    else:
        form = form_class()
    context =  {'form': form }
    context.update(extra_context or {}) 
    return context
コード例 #15
0
ファイル: forms.py プロジェクト: Dpetters/Umeqo
    def save(self, domain_override=None,
             email_template_name='registration/password_reset_email.html',
             use_https=False, token_generator=default_token_generator, from_email=None, 
             request=None):
        """
        Generates a one-use only link for resetting password and sends to the user
        """
        for user in self.users_cache:
            html_email_template_name = email_template_name
            text_email_template_name='password_reset_email.txt'
            text_email_body_template = loader.get_template(text_email_template_name)
            html_email_body_template = loader.get_template(html_email_template_name)
            
            context = Context({
                'email': user.email,
                'uid': int_to_base36(user.id),
                'first_name': user.first_name,
                'token': token_generator.make_token(user),
            })
            context.update(get_basic_email_context())

            subject = ''.join(render_to_string('email_subject.txt', {
                'message': "Password Reset"
            }, context).splitlines())
        
            text_email_body = text_email_body_template.render(Context(context)) 
            html_email_body = html_email_body_template.render(Context(context))

            send_email(subject, text_email_body, [user.email], html_email_body)
コード例 #16
0
def reminder_notifications_not_emailed(task):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	press_name = models.Setting.objects.get(group__name='general', name='press_name').value
	days = int(models.Setting.objects.get(group__name='cron', name='notification_reminder').value)
	email_text = models.Setting.objects.get(group__name='email', name='notification_reminder_email').value
	dt = timezone.now()
	target_date = dt - timedelta(days=days)

	editors = User.objects.filter(Q(profile__roles__slug='press-editor') | Q(profile__roles__slug='book-editor') | Q(profile__roles__slug='production-editor'))
  
	for editor in editors:
		tasks = models.Task.objects.filter(assignee = editor, emailed = False, completed__isnull = True)
		task_list = ""
		for notification in tasks:
			task_list = task_list +'- '+ notification.text + "\n"
			notification.emailed = True
			notification.save()

		if task_list:
			
			context = {
				'user': editor,
				'notifications': task_list,
				'notification_count': tasks.count(),
				'press_name': press_name,
				'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,	
			}
			email.send_email(get_setting('weekly_notification_reminder_subject','email_subject','Weekly Notification Reminder'), context, from_email.value, editor.email, email_text)
コード例 #17
0
ファイル: execute_cron_tasks.py プロジェクト: StuJ/rua-1
def send_reminder_email(book, subject, review, email_text):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )
    press_name = models.Setting.objects.get(group__name='general',
                                            name='press_name').value

    context = {
        'book':
        book,
        'review':
        review,
        'press_name':
        press_name,
        'base_url':
        models.Setting.objects.get(group__name='general',
                                   name='base_url').value,
    }
    email.send_email(
        subject,
        context,
        from_email.value,
        review.user.email,
        email_text,
        book=book,
        kind='reminder',
    )
コード例 #18
0
ファイル: views.py プロジェクト: Dpetters/Umeqo
def employer_new(request, form_class=CreateEmployerForm, extra_context=None):
    if not (request.user.is_authenticated() and hasattr(request.user, "campusorg") or hasattr(request.user, "student")):
        raise Http403("You must be logged in.")
    if request.method == 'POST':
        form = form_class(data=request.POST)
        if form.is_valid():
            new_employer = form.save()
            recipients = [mail_tuple[1] for mail_tuple in s.MANAGERS]
            
            context = Context({'first_name':request.user.first_name,
                               'last_name': request.user.last_name,
                               'email':request.user.email,
                               'new_employer':new_employer,
                               'new_employer_industries':" ".join(map(lambda x: x.name, new_employer.industries.all()))})
            context.update(get_basic_email_context())
             
            body = render_to_string('employer_new_email_body.txt', context)
                                    
            subject = ''.join(render_to_string('email_admin_subject.txt', {
                'message': "New Employer: %s" % new_employer 
            }, context).splitlines())
                            
            send_email(subject, body, recipients)
            
            data = {"name": new_employer.name, "id": new_employer.id}
        else:
            data = {'errors': form.errors }
        return HttpResponse(simplejson.dumps(data), mimetype="application/json")
    else:
        form = form_class()
    context = {'form': form }
    context.update(extra_context or {}) 
    return context
コード例 #19
0
ファイル: views.py プロジェクト: Dpetters/Umeqo
def account_request(request, form_class = AccountRequestForm, extra_context=None):
    if request.method=="POST":
        form = form_class(data = request.POST)
        if form.is_valid():
            data = []
            recipients = [mail_tuple[1] for mail_tuple in s.MANAGERS]
            
            context = Context({})
            context.update(get_basic_email_context())
            subject = ''.join(render_to_string('email_admin_subject.txt', {
                'message': "Account Request"
            }, context).splitlines())
            
            subscription_email_context = {'form':form}
            email_body = render_to_string('account_request_email_body.txt', subscription_email_context)
            send_email(subject, email_body, recipients)
        else:
            data = {'errors':form.errors}
        return HttpResponse(simplejson.dumps(data), mimetype="application/json")
    else:
        context = {}
        subscription_type = request.GET.get('subscription_type', 'basic')
        initial = {'message_body':render_to_string('account_request_body.html', {'subscription_type':subscription_type})}
        context['form'] = form_class(initial=initial)
        context.update(extra_context or {})
        return context
コード例 #20
0
ファイル: views.py プロジェクト: maleroy1709/happyschool
def send_emails(passage, template, subject):
    eleve = People().get_student_by_id(passage.matricule.matricule)
    if check_student_photo(eleve, copy=False):
        image = static("/photos/" + str(passage.matricule.matricule) + ".jpg")
    else:
        image = static("/photos/unknown.jpg")

    context = {
        'eleve': eleve,
        'heure_arrive': passage.datetime_arrive,
        'commentaire': passage.motifs_admission,
        'passage': passage,
        'phone_number': get_settings().phone_number
    }
    recipients = email.get_resp_emails(eleve)
    recipients_emails = []
    for r in recipients.items():
        recipients_emails.append(r[0])

    if not settings.DEBUG:
        email.send_email(to=recipients,
                         subject="[Infirmerie] %s %s %s" %
                         (subject, eleve.fullname, eleve.classe.compact_str),
                         email_template="infirmerie/" + template + ".html",
                         context=context,
                         images=[image])
    else:
        print("Sending to: " + str(recipients_emails))
        email.send_email(to=[settings.EMAIL_ADMIN],
                         subject="[Infirmerie] %s %s %s" %
                         (subject, eleve.fullname, eleve.classe.compact_str),
                         email_template="infirmerie/" + template + ".html",
                         context=context,
                         images=[image])
コード例 #21
0
def _get_item_ref(item_name, tv_invoice_id, is_manual):
    result = queryItem(item_name)
    if 'item' in result:
        ItemRef = {
            'name': result['item']['Name'],
            'value': result['item']['Id']
        }
    else:
        try:
            item = createItem(item_name)
            ItemRef = {
                'name': item['Item']['Name'],
                'value': item['Item']['Id']
            }
        except Exception as e:
            logger.error(
                'error creating item: {0} in Quickbooks while processing trackvia {2} invoice: {1}'.format(
                    item_name,
                    tv_invoice_id,
                    "manual" if is_manual else ""
                ))
            send_email('TV-QBO integeration error',
                       'We got an error creating item: {0} in Quickbooks while processing trackvia {2} invoice: {1}. Invoice creation/updation failed. Please check line items in trackvia and retry.'.format(
                           item_name, tv_invoice_id, "manual" if is_manual else ""))
            raise Exception()
    return ItemRef
コード例 #22
0
ファイル: views.py プロジェクト: Lyior/happyschool
def traiter(request):
    # Add informations/modifications.
    is_traiter = 'traiter' in request.POST

    form = TraiterAppelForm(request.POST)
    if form.is_valid():
        a = Appel.objects.get(pk=request.POST['id'])
        a.objet = form.cleaned_data['objet']
        a.motif = form.cleaned_data['motif']
        a.commentaire = form.cleaned_data['commentaires']
        a.datetime_appel = form.cleaned_data['datetime_appel']
        a.traitement = form.cleaned_data['remarques']
        a.custom_email = form.cleaned_data['custom_email']
        if is_traiter:
            a.datetime_traitement = form.cleaned_data['datetime_traitement']
            a.is_traiter = True

        # Add emails
        a.emails.clear()
        for e in form.cleaned_data['emails']:
            a.emails.add(e)

        a.save()

        # Send emails
        if is_traiter:
            context = {'appel': a}
            image = []
            name = a.name
            if a.is_student:
                # etudiant = student_man.get_person(a.matricule.matricule)
                etudiant = People().get_student_by_id(a.matricule.matricule,
                                                      ['all'])
                name = str(etudiant)
                context['etudiant'] = etudiant
                image = [
                    static("/photos/" + str(a.matricule.matricule) + ".jpg")
                ]

            sent_to = list(
                filter(lambda e: e != '*****@*****.**',
                       map(lambda e: e.email, a.emails.all())))
            if a.custom_email:
                sent_to.append(a.custom_email)
            if not settings.DEBUG:
                email.send_email(to=sent_to,
                                 subject="[Appel] %s" % name,
                                 email_template="appels/email.html",
                                 context=context,
                                 images=image)
            else:
                print(sent_to)
                email.send_email(to=[settings.EMAIL_ADMIN],
                                 subject="[Appel] %s" % name,
                                 email_template="appels/email.html",
                                 context=context,
                                 images=image)
    else:
        print(form.errors)
コード例 #23
0
    def handle(self, *args, **options):

        #employers = Employer.objects.visible().filter(feature_in_monthly_newsletter=True)
        all_events_and_deadlines = Event.objects.filter(
            include_in_monthly_newsletter=True)
        events = filter(lambda x: not x.is_deadline() and not x.is_past(),
                        all_events_and_deadlines)
        deadlines = filter(lambda x: x.is_deadline(), all_events_and_deadlines)

        if events or deadlines:
            year = datetime.now().strftime("%Y")
            month = datetime.now().strftime("%B")

            for i, student in enumerate(
                    Student.objects.filter(
                        user__is_active=True,
                        user__userattributes__is_verified=True,
                        studentpreferences__receive_monthly_newsletter=True,
                        first_name="Dmitrij")):

                if i % 5 == 0:
                    time.sleep(1)
                context = Context({
                    'first_name': student.first_name,
                    'student': student,
                    #'employer':employers,
                    'events': events,
                    'deadlines': deadlines,
                    'month': month,
                    'year': year
                })
                context.update(get_basic_email_context())

                text_email_body = render_to_string("monthly_newsletter.txt",
                                                   context)
                html_email_body = render_to_string("monthly_newsletter.html",
                                                   context)
                html_email_body = Pynliner().from_string(html_email_body).run()

                subject = ''.join(
                    render_to_string('email_subject.txt', {
                        'message': "%s Newsletter" % month
                    }, context).splitlines())

                send_email(subject, text_email_body, [student.user.email])

            newsletter_path = "%s/newsletter/templates/%s/" % (s.ROOT, year)
            if not os.path.exists(newsletter_path):
                os.makedirs(newsletter_path)

            context['first_name'] = None
            context['student'] = None
            body = render_to_string("monthly_newsletter.html", context)
            body = Pynliner().from_string(body).run()

            f = open("%s%s.html" % (newsletter_path, month), "w")
            f.write(body)
            f.close()
コード例 #24
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_proposal_decline(proposal, email_text, sender):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'proposal': proposal,
		'sender': sender,
	}

	email.send_email(get_setting('proposal_declined_subject','email_subject','[abp] Proposal Declined'), context, from_email.value, proposal.owner.email, email_text, kind = 'proposal')
コード例 #25
0
ファイル: execute_cron_tasks.py プロジェクト: NateWr/rua
def send_reminder_email(book, subject, review, email_text):
    from_email = models.Setting.objects.get(group__name='email', name='from_address')

    context = {
        'book': book,
        'review': review,
    }

    email.send_email(subject, context, from_email.value, review.user.email, email_text, book=book)
コード例 #26
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_review_request(
    book,
    review_assignment,
    email_text,
    sender,
    attachment=None,
    access_key=None,
):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )
    base_url = models.Setting.objects.get(
        group__name='general',
        name='base_url',
    )
    press_name = models.Setting.objects.get(
        group__name='general',
        name='press_name',
    ).value

    if access_key:
        decision_url = (
            'http://%s/review/%s/%s/assignment/%s/access_key/%s/decision/' % (
                base_url.value,
                review_assignment.review_type,
                book.id,
                review_assignment.id,
                access_key,
            ))
    else:
        decision_url = ('http://%s/review/%s/%s/assignment/%s/decision/' %
                        (base_url.value, review_assignment.review_type,
                         book.id, review_assignment.id))

    context = {
        'book': book,
        'review': review_assignment,
        'decision_url': decision_url,
        'sender': sender,
        'base_url': base_url.value,
        'press_name': press_name,
    }

    email.send_email(
        subject=get_setting('review_request_subject', 'email_subject',
                            'Review Request'),
        context=context,
        from_email=from_email.value,
        to=review_assignment.user.email,
        html_template=email_text,
        book=book,
        attachment=attachment,
        kind='review',
        access_key=access_key,
    )
コード例 #27
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_proposal_revisions(proposal, email_text, sender):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'proposal': proposal,
		'sender': sender,
	}

	email.send_email(get_setting('proposal_revision_required_subject','email_subject','[abp] Proposal Revisions Required'), context, from_email.value, proposal.owner.email, email_text, kind = 'proposal')
コード例 #28
0
ファイル: logic.py プロジェクト: stuartjennings-up/rua
def send_proposal_update(proposal, email_text, sender,receiver):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'proposal': proposal,
		'sender': sender,
		'receiver':receiver,
	}
	subject = get_setting('proposal_update_subject','email_subject','[abp] Proposal Update')
	email.send_email(subject, context, from_email.value, proposal.owner.email, email_text, proposal = proposal, kind = 'proposal')
コード例 #29
0
 def send_emails(self, instance, subject, is_new):
     """Send an email to notify new absence and change."""
     context = {'absence': instance, 'new': is_new}
     emails = list(get_settings().emails.all())
     if emails:
         emails = [e.email for e in emails]
         email.send_email(to=emails,
                          subject=subject,
                          email_template='absence_prof/email.html',
                          context=context)
コード例 #30
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_author_sign_off(submission, email_text, sender):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'submission': submission,
		'sender': sender,
	}

	email.send_email(get_setting('book_contract_uploaded_subject','email_subject','Book Contract Uploaded'), context, from_email.value, submission.owner.email, email_text, book=submission, kind = 'submission')
コード例 #31
0
ファイル: logic.py プロジェクト: stuartjennings-up/rua
def send_production_editor_ack(book, editor, email_text, attachment=None):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	base_url = models.Setting.objects.get(group__name='general', name='base_url')

	context = {
		'submission': book,
		'editor': editor,
	}
	subject = get_setting('production_editor_subject','email_subject','Production Editor for {0}'.format(book.full_title))
	email.send_email(subject, context, from_email.value, editor.email, email_text, book=book, attachment=attachment, kind = 'production')
コード例 #32
0
ファイル: logic.py プロジェクト: StuJ/rua-1
def send_editorial_review_request(book,
                                  review_assignment,
                                  email_text,
                                  sender,
                                  attachment=None):
    from_email = models.Setting.objects.get(
        group__name='email',
        name='from_address',
    )
    base_url = models.Setting.objects.get(
        group__name='general',
        name='base_url',
    )
    press_name = models.Setting.objects.get(
        group__name='general',
        name='press_name',
    ).value

    if review_assignment.publishing_committee_access_key:
        decision_url = 'http://%s/editorial/submission/%s/access_key/%s/' % (
            base_url.value,
            book.id,
            review_assignment.publishing_committee_access_key,
        )
        access_key = review_assignment.publishing_committee_access_key
    else:
        decision_url = 'http://%s/editorial/submission/%s/access_key/%s/' % (
            base_url.value,
            book.id,
            review_assignment.editorial_board_access_key,
        )
        access_key = review_assignment.editorial_board_access_key

    context = {
        'book': book,
        'review': review_assignment,
        'decision_url': decision_url,
        'sender': sender,
        'base_url': base_url.value,
        'press_name': press_name,
    }

    for editor in review_assignment.editorial_board.all():
        email.send_email(
            get_setting('editorial_review_request', 'email_subject',
                        'Editorial Review Request'),
            context,
            from_email.value,
            editor.email,
            email_text,
            book=book,
            attachment=attachment,
            kind='review',
            access_key=access_key,
        )
コード例 #33
0
ファイル: views.py プロジェクト: Dpetters/Umeqo
            def send_event_company_representative_access_instructions():
                context['event'] = event

                text_body = render_to_string('recruiter_event_participant_access_instructions.txt', context)
                html_body = render_to_string('recruiter_event_participant_access_instructions.html', context)
            
                subject = ''.join(render_to_string('email_subject.txt', {
                    'message': "%s Student Browsing Instructions" % event.name
                }, context).splitlines())
                            
                send_email(subject, text_body, recipients, html_body)
コード例 #34
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_new_user_ack(submission, email_text, new_user, code):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'user': new_user,
		'code': code,
		'submission':submission,
	}

	email.send_email(get_setting('new_user_subject','email_subject','New User : Profile Details'), context, from_email.value, new_user.email, email_text, book=submission, kind = 'general')
コード例 #35
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_copyedit_assignment(submission, copyedit, email_text, sender, attachment=None):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'submission': submission,
		'copyedit': copyedit,
		'sender': sender,
	}

	email.send_email(get_setting('copyedit_assignment_subject','email_subject','Copyedit Assignment'), context, from_email.value, copyedit.copyeditor.email, email_text, book=submission, attachment=attachment, kind = 'copyedit')
コード例 #36
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_proposal_book_editor(request, proposal, email_text, sender):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	if request:
		from_email = "%s <%s>" % (request.user.profile.full_name(),from_email.value)

	context = {
		'proposal': proposal,
		'sender': sender,
	}

	email.send_email(get_setting('proposal_book_editors_subject','email_subject','[abp] Proposal Book Editors: Update'), context, from_email, proposal.owner.email, email_text, proposal = proposal, request = request, kind = 'proposal')
コード例 #37
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_author_invite(submission, copyedit, email_text, sender, attachment=None):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'submission': submission,
		'copyedit': copyedit,
		'sender': sender,
	}

	email.send_email(get_setting('copyediting_completed_subject','email_subject','Copyediting Completed'), context, from_email.value, submission.owner.email, email_text, book=submission, attachment=attachment, kind = 'copyedit')
コード例 #38
0
ファイル: logic.py プロジェクト: stuartjennings-up/rua
def send_task_decline(assignment,type, email_text, sender, request):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	if request:
		from_email = "%s <%s>" % (request.user.profile.full_name(),from_email.value)

	context = {
		'assignment': assignment,
		'sender': sender,
	}
	subject = get_setting('assignment_declined_subject','email_subject','[abp] %s Assignment [id<%s>] Declined') % (type.title(),assignment.id)
	email.send_email(subject, context, from_email, assignment.requestor.email, email_text, request = request, kind = 'workflow')
コード例 #39
0
ファイル: logic.py プロジェクト: stuartjennings-up/rua
def send_proposal_decline(request, proposal, email_text, sender):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	if request:
		from_email = "%s <%s>" % (request.user.profile.full_name(),from_email.value)

	context = {
		'proposal': proposal,
		'sender': sender,
	}
	subject = get_setting('proposal_declined_subject','email_subject','[abp] Proposal Declined')
	email.send_email(subject, context, from_email, proposal.owner.email, email_text, proposal = proposal, request = request, kind = 'proposal')
コード例 #40
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_proposal_accept(proposal, email_text, submission, sender, attachment=None):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'proposal': proposal,
		'submission': submission,
		'sender': sender,
	}

	email.send_email(get_setting('proposal_accepted_subject','email_subject','[abp] Proposal Accepted'), context, from_email.value, proposal.owner.email, email_text, book=submission, attachment=attachment)
コード例 #41
0
ファイル: logic.py プロジェクト: NateWr/rua
def send_requests_revisions(book, revision, email_text):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	base_url = models.Setting.objects.get(group__name='general', name='base_url').value

	context = {
		'book': book,
		'revision': revision,
		'revision_url': "http://%s/revisions/%s" % (base_url, revision.id)
	}

	email.send_email('Revisions Requested', context, from_email.value, book.owner.email, email_text, book=book)
コード例 #42
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_invite_indexer(book, index, email_text, sender, attachment):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'submission': book,
		'index': index,
		'sender': sender,
	}

	email.send_email(get_setting('indexing_request_subject','email_subject','Indexing Request'), context, from_email.value, index.indexer.email, email_text, book=book, attachment=attachment, kind = 'index')
コード例 #43
0
ファイル: logic.py プロジェクト: stuartjennings-up/rua
def send_new_user_ack(email_text, new_user, profile):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	press_name = models.Setting.objects.get(group__name='general', name='press_name').value

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'user': new_user,
		'profile': profile,
		'press_name': press_name,
	}
	subject = get_setting('registration_confirmation_subject','email_subject','Registration Confirmation')
	email.send_email(subject, context, from_email.value, new_user.email, email_text, kind = 'general')
コード例 #44
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_review_update(book, review_assignment, email_text, sender, attachment=None):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	base_url = models.Setting.objects.get(group__name='general', name='base_url')

	print email_text
	context = {
		'book': book,
		'review': review_assignment,
		'sender': sender,
	}

	email.send_email(get_setting('review_due_date_subject','email_subject','Review Assignment %s: Due Date Updated') % review_assignment.id, context, from_email.value, review_assignment.user.email, email_text, book=book, attachment=attachment, kind = 'review')
コード例 #45
0
def send_reminder_email(book, subject, review, email_text):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	press_name = models.Setting.objects.get(group__name='general', name='press_name').value

	context = {
		'book': book,
		'review': review,
		'press_name':press_name,
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,	
	}

	email.send_email(subject, context, from_email.value, review.user.email, email_text, book=book, kind = 'reminder')
コード例 #46
0
ファイル: logic.py プロジェクト: NateWr/rua
def send_proposal_review_request(proposal, review_assignment, email_text):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	base_url = models.Setting.objects.get(group__name='general', name='base_url')

	review_url = 'http://%s/review/%s/%s/' % (base_url.value, 'proposal', proposal.id)

	context = {
		'review': review_assignment,
		'review_url': review_url,
	}

	email.send_email('Proposal Review Request', context, from_email.value, review_assignment.user.email, email_text)
コード例 #47
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_invite_typesetter(book, typeset, email_text, sender, attachment=None):

	from_email = models.Setting.objects.get(group__name='email', name='from_address')

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'submission': typeset.book,
		'typeset': typeset,
		'sender': sender,
	}

	email.send_email(get_setting('typesetting_subject','email_subject','Typesetting'), context, from_email.value, typeset.typesetter.email, email_text, book=book, attachment=attachment, kind = 'typeset')
コード例 #48
0
def _getVendorRef(name):
    vendorRef = getVendor(name)
    if not vendorRef:
        logger.error(
            'error finding customer: {0} in Quickbooks while processing trackvia bill'
            .format(name))
        send_email(
            'TV-QBO integeration error',
            'We got an error finding customer: {0} in Quickbooks while processing trackvia bill.'
            ' Bill creation/updation failed. Please create customer in quickbooks and retry.'
            .format(name))
        raise Exception()
    return {'value': vendorRef['Vendor']['Id']}
コード例 #49
0
ファイル: tasks.py プロジェクト: abhishm20/mass-mailer
def send_email_task(email_data):
    # Send email method call
    d = {
        'sender_name': 'Finshots',
        'sender': email_data['sender'],
        'recipients': email_data['to'].split(",") if email_data['to'] else [],
        'subject': email_data['subject'],
        'body_html': email_data['body']
    }
    d['recipients'] += email_data['cc'].split(",") if email_data['cc'] else []
    email.send_email(d)
    Email.objects.select_for_update().filter(
        tracking_id=email_data['tracking_id']).update(is_sent=True)
コード例 #50
0
ファイル: logic.py プロジェクト: StuJ/rua
def send_book_editors(book, added_editors,removed_editors,email_text):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	base_url = models.Setting.objects.get(group__name='general', name='base_url').value

	context = {
		'base_url':base_url,
		'submission': book,
		'added_editors': added_editors,
		'removed_editors':removed_editors,
		'submission_page': "http://%s/editor/submission/%s/" % (base_url, book.id)
	}
	if added_editors or removed_editors:
		email.send_email(get_setting('book_editors_subject','email_subject','Book Editors have been updated'), context, from_email.value, book.owner.email, email_text, book=book, kind = 'general')
コード例 #51
0
ファイル: logic.py プロジェクト: stuartjennings-up/rua
def send_proposal_accept(request, proposal, email_text, submission, sender, attachment=None):
	from_email = models.Setting.objects.get(group__name='email', name='from_address')
	if request:
		from_email = "%s <%s>" % (request.user.profile.full_name(),from_email.value)

	context = {
		'base_url': models.Setting.objects.get(group__name='general', name='base_url').value,
		'proposal': proposal,
		'submission': submission,
		'sender': sender,
	}
	subject = get_setting('proposal_accepted_subject','email_subject','[abp] Proposal Accepted')
	email.send_email(subject, context, from_email, proposal.owner.email, email_text, proposal=proposal, book=submission, attachment=attachment, request = request, kind = 'proposal')
コード例 #52
0
ファイル: logic.py プロジェクト: NateWr/rua
def send_review_request(book, review_assignment, email_text, attachment=None):
    from_email = models.Setting.objects.get(group__name='email', name='from_address')
    base_url = models.Setting.objects.get(group__name='general', name='base_url')

    decision_url = 'http://%s/review/%s/%s/assignment/%s/decision/' % (base_url.value, review_assignment.review_type, book.id, review_assignment.id)

    context = {
        'book': book,
        'review': review_assignment,
        'decision_url': decision_url,
    }

    email.send_email('Review Request', context, from_email.value, review_assignment.user.email, email_text, book=book, attachment=attachment)
コード例 #53
0
def _customer_ref(cust_name, tv_invoice_id, is_manual):
    result = queryCustomer(cust_name)
    if 'Customer' in result:
        return {'value': result['Customer']['Id']}
    else:
        logger.error(
            'error finding customer: {0} in Quickbooks while processing trackvia {2} invoice: {1}'.format(
                cust_name,
                tv_invoice_id,
                "manual" if is_manual else ""))
        send_email('TV-QBO integeration error',
                   'We got an error finding customer: {0} in Quickbooks while processing trackvia {2} invoice: {1}. Invoice creation/updation failed. Please create customer in quickbooks and retry.'.format(
                       cust_name, tv_invoice_id, "manual" if is_manual else ""))
        raise Exception()
コード例 #54
0
def _customer_ref(cust_name, df_id):
    result = queryCustomer(cust_name)
    if 'Customer' in result:
        return {'value': result['Customer']['Id']}
    else:
        logger.error(
            'error finding customer: {0} in Quickbooks while processing trackvia design fee: {1}'
            .format(cust_name, df_id))
        send_email(
            'TV-QBO integeration error',
            'We got an error finding customer: {0} in Quickbooks while processing trackvia trackvia design fee:'
            ' {1}. design fee creation/updation failed. Please create customer in quickbooks and retry.'
            ''.format(cust_name, df_id))
        raise Exception()
コード例 #55
0
ファイル: views.py プロジェクト: Dpetters/Umeqo
def employer_resume_book_email(request, extra_context=None):
    if not request.POST.has_key('emails'):
        raise Http400("Request POST is missing the emails.")
    if request.POST.has_key("resume_book_id") and request.POST['resume_book_id']:
        redelivering = True
        try:
            resume_book = ResumeBook.objects.get(id=request.POST["resume_book_id"])
        except ResumeBook.DoesNotExist:
            raise Http404("No resume book exists with id of %s" % request.POST["resume_book_id"])
    else:
        redelivering = False
        try:
            resume_book, created = ResumeBook.objects.get_or_create(recruiter = request.user.recruiter, delivered=False)
        except ResumeBook.MultipleObjectsReturned:
            resume_books = ResumeBook.objects.filter(recruiter=request.user.recruiter, delivered=False)
            for i, rb in enumerate(resume_books):
                if i != 0:
                    rb.delete()
                else:
                    resume_book = rb
    reg = re.compile(r"\s*[;, \n]\s*")
    recipients = reg.split(request.POST['emails'])
    site = get_current_site(request)
    subject = "[%s] Resume Book Delivery" % (site.name)
    f = open("%s%s" % (s.MEDIA_ROOT, resume_book.resume_book.name), "rb")
    content = f.read()
    if request.POST.has_key('name') and request.POST['name']:
        filename = request.POST['name']
    else:
        filename = os.path.basename(resume_book.name)

    context = get_basic_email_context()
    context['deliverer_fullname'] = "%s %s" % (request.user.first_name, request.user.last_name)
    context['deliverer_email'] = request.user.email

    for recipient in recipients:
        context['first_name'] = recipient.split("@")[0]
        text_email_body = render_to_string('resume_book_email_body.txt', context)
        html_email_body = render_to_string('resume_book_email_body.html', context)
        send_email(subject, text_email_body, recipients, html_email_body, "%s.pdf" % (filename), content, "application/pdf")
    if redelivering:
        resume_book.last_updated = datetime.now()
    else:
        resume_book.name = filename
        resume_book.delivered = True
    resume_book.save()
    context = {}
    context.update(extra_context or {})
    return context
コード例 #56
0
def send_quote_accepted_email_to_developer(project_member):
    if project_member.member.safe_settings.get('quote_accepted_to_developer',
                                               True):
        return send_email([project_member.member.email],
                          'Your bid was accepted',
                          'emails/projects/quote_accepted_developer.html',
                          {'project_member': project_member})
コード例 #57
0
def send_project_assigned_email(project):
    assert project.manager, 'Project manager should be assigned'
    if project.manager.safe_settings.get('new_project', True):
        return send_email([project.manager.email],
                          'New project assigned to you',
                          'emails/projects/project_assigned.html',
                          {'project': project})
コード例 #58
0
def send_task_assigned_email(user, task):
    if user.safe_settings.get('new_task_assigned', True):
        return send_email([user.email], 'New task assigned',
                          'emails/projects/new_task_assigned.html', {
                              'user': user,
                              'task': task
                          })