def post_save_announcement(instance, created, **kwargs): if created: subject = instance.title context = {'announcement': instance} template_name = 'courses/announcement_mail.html' users = Enrollment.objects.filter(course=instance.course, status=1) for user in users: recipient_list = [user.user.email] send_mail_template(subject, template_name, context, recipient_list)
def send_mail(self, curso): subject = '[%s] Contato' % curso context = { 'name': self.cleaned_data['name'], 'email': self.cleaned_data['email'], 'message': self.cleaned_data['message'], } template_name = 'cursos/contact_email.html' send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
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_mail.html' subject = 'Criar nova senha no Simple MOOC' context = { 'reset': reset, } send_mail_template(subject, template_name, context, [user.email])
def send_mail(self, course): print('Olá Mundo!') subject = f'[{course}] Contato' 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])
def post_save_announcement(instance, created, **kwargs): if created: template_name = "courses/announcement_mail.html" subject = instance.title context = {'announcement': instance} enrollments = Enrollment.objects.filter(course=instance.course, status=1) for enrollment in enrollments: recipient_list = [enrollment.user.email] print("Email: ", recipient_list) send_mail_template(subject, template_name, context, recipient_list, [settings.EMAIL_HOST_USER])
def post_save_announcements(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)
def send_mail(self, course): subject = '[%s] Contato' % course message = 'Nome: %(name)s.Email: %(email)s;%(message)s' context = { 'name': self.cleaned_data['name'], 'email': self.cleaned_data['email'], 'message': self.cleaned_data['message'], } template_name = 'courses/contact_mail.html' send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL]) '''
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_mail.html" subject = "Criar nova senha no Simple MOOC" context = { "reset": reset } send_mail_template(subject, template_name, context, [user.email])
def send_mail(self, course): subject = f"{course.name} Curso" 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] )