コード例 #1
0
ファイル: forms.py プロジェクト: antoniomalves/simplemooc
    def send_mail(self, course):
        subject = '[%s] Contato' % course
        context = {
            'name': self.cleaned_data['name'],
            'email': self.cleaned_data['email'],
            'message': self.cleaned_data['message'],
        }
        template_name = 'courses/contact_email.html'
        send_mail_template(
            subject, template_name, context, [settings.CONTACT_EMAIL]
        )

    # Envio antigo, sem o uso de template
    # def send_mail(self, course):
    #     subject = '[%s] Contato' % course
    #     message = 'Nome: %(name)s;E-mail: %(email)s;%(message)s'
    #     context = {
    #         'name': self.cleaned_data['name'],
    #         'email': self.cleaned_data['email'],
    #         'message': self.cleaned_data['message'],
    #     }
    #     message = message % context
    #     send_mail(
    #         subject, message, settings.DEFAULT_FROM_EMAIL, 
    #         [settings.CONTACT_EMAIL]
    #     )
コード例 #2
0
ファイル: models.py プロジェクト: leandrobraga/simplemooc
def post_save_announcement(instance, created, **kwargs):
    if created:
        subject = instance.title
        context = {'announcement': instance}
        template_name = "courses/announcement_mail.html"
        enrollments = Enrollment.objects.filter(course=instance.course, status=1)
        for enrollment in enrollments:
            recipient_list = [enrollment.user.email]
            send_mail_template(subject, template_name, context, recipient_list)
コード例 #3
0
ファイル: forms.py プロジェクト: leandrobraga/simplemooc
    def save(self):

        user = User.objects.get(email=self.cleaned_data['email'])
        key = generate_hash_key(user.username)
        reset = PasswordReset(key=key, user=user)
        reset.save()
        template_name = "accounts/password_reset_email.html"
        subject = "Criar nova senha no simplemooc"
        context = {'reset': reset}
        send_mail_template(subject, template_name, context, [user.email])
コード例 #4
0
 def send_mail(self, course):
     subject = 'Contato sobre o curso {}'.format(course)
     context = {
         'name': self.cleaned_data['name'],
         'email': self.cleaned_data['email'],
         'message': self.cleaned_data['message']
     }
     template_name = 'courses/contact_email.html'
     send_mail_template(subject, template_name, context,
                        [settings.CONTACT_EMAIL])
コード例 #5
0
ファイル: forms.py プロジェクト: andresgomes/simplemooc
	def send_mail(self,course):
		subject = '[%s] Contato' % course
		context = {
			'name': self.cleaned_data['name'],
			'email': self.cleaned_data['email'],
			'message': self.cleaned_data['message']
		}
		template_name = "courses/contact_email.html"
		send_mail_template(
			subject, template_name, context, [settings.CONTACT_EMAIL]
		)
コード例 #6
0
ファイル: forms.py プロジェクト: helderjosex/django-projects
 def save(self):
     user = User.objects.get(email=self.cleaned_data['email'])
     key = generate_hash_key(user.username)
     reset = PasswordReset(key=key, user=user)
     reset.save()
     template_name = 'password_reset_mail.html'
     subject = 'Criar nova senha no Simple MOOC'
     context = {
         'reset': reset,
     }
     send_mail_template(subject, template_name, context, [user.email])
コード例 #7
0
 def send_mail(self, course):
     subject = '[%s] Contato' % course
     context = {
         'name' : self.cleaned_data['name'],
         'email' : self.cleaned_data['email'],
         'message' : self.cleaned_data['message'],
     }
     template_name = 'courses/contact_email.html'
     # Chama a função send_mail_template que foi definida no core do projeto simplemooc
     send_mail_template(
         subject, template_name, context, [settings.CONTACT_EMAIL]
     )
コード例 #8
0
ファイル: forms.py プロジェクト: nenodias/neno-simplemooc
 def save(self):
     user = User.objects.get( email=self.cleaned_data['email'] )
     key = generate_hash_key(user.username)
     reset = PasswordReset(user=user, key=key)
     reset.save()
     template_name = 'accounts/password_reset_mail.html'
     domain = self.request.build_absolute_uri('/')[:-1]
     subject = 'Criar nova senha no SimpleMooc'
     context = {
         'reset': reset,
         'domain': domain
     }
     send_mail_template(subject, template_name, context, [ user.email ])
コード例 #9
0
ファイル: forms.py プロジェクト: leandrobraga/simplemooc
    def send_mail(self, course):

        subject = '[%s] Contato' % course
        #message = 'Nome: %(name)s;E-mail: %(email)s;%(message)s'
        context = {
            'name': self.cleaned_data['name'],
            'email': self.cleaned_data['email'],
            'message': self.cleaned_data['message'],

        }
        template_name = "courses/contact_email.html"
        #message = message % context
        #send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [settings.CONTACT_EMAIL])
        send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
コード例 #10
0
ファイル: models.py プロジェクト: mazulo/simplemooc
def post_save_announcement(instance, created, **kwargs):
    subject = instance.title
    context = {
        'announcement': instance,
    }
    template_name = 'courses/announcement_mail.html'
    # import ipdb; ipdb.set_trace()
    content_type = ContentType.objects.get_for_model(instance)
    enrollments = Enrollment.objects.filter(
        content_type=content_type, status=1
    )
    for enrollment in enrollments:
        recipient_list = [enrollment.user.email]
        send_mail_template(subject, template_name, context, recipient_list)