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] # )
def post_save_announcement(instance, created, **kwargs): 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 save(self): user = User.objects.get(email=self.cleaned_data['email']) key = generate_hash_key(user.username) reset = PasswordReset(kay=key, user=user) 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 save(self): template_name = 'accounts/password_reset_mail.html' user = User.objects.get(email=self.cleaned_data['email']) key = generate_hash_key(user.username) reset = PasswordReset(key=key, user=user) reset.save() context = {'reset': reset} subject = _('Criar nova senha para a sua conta do SimpleMooc') send_mail_template(subject, template_name, context, [user.email])
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] )
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)
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_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_email.html" subject = "Criar nova senha no simplemooc" context = {'reset': reset} send_mail_template(subject, template_name, context, [user.email])
def post_save_announcement(instance, created, **kwargs): if created: #para enviar o e-mail apenas quando o anuncio for criado (e não sempre que for atualizado) subject = instance.title context = {'announcement': instance} template_name = 'courses/announcements_mail.html' enrollements = Enrollment.objects.filter(course=instance.course, status=1) for enrollement in enrollements: #Laço incluído para não não lançar apenas um e-mail para todos os usuários(que poderia ser feito passando a lista dos e-mails, porém os e-mails ficaram em copia(do e-mail)). recipient_list = [enrollement.user.email] send_mail_template(subject, template_name, context, recipient_list)
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])
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 = '[%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])
def send_email(self): subject='Contato sobre o curso' 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_email.html' message = message % context send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
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] )
def send_mail(self, course): subject = 'Dúvida Sobre: [%s]' % course.name message = 'Nome: %(name)s;\nE-mail: %(email)s;\n%(message)s' 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 send_mail(self, course): subject = '[%s] Contato' % course context = { 'name': self.cleaned_data['name'], 'email': self.cleaned_data['email'], 'message': self.cleaned_data['message'] } send_mail_template(subject, 'courses/contact_mail.html', context, [context['email']])
def post_save_announcement(instance, created, **kwargs): if created: #caso o anúncio tenha sido criado faça subject = instance.title template_name = 'courses/announcement_mail.html' context = { 'announcement':instance } 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 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])
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 template_name = 'contact_email.html' send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
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] )
def send_mail(self, course): template_name = "courses/contact_email.html" subject = '[%s] Contato' % course context = { "name": self.cleaned_data["name"], "email": self.cleaned_data["email"], "msg": self.cleaned_data["msg"] } send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
def send_mail(self, courses): subject = f'Duvida sobre o curso: {courses}' # CAPTURA OS DADOS DIGITADOS NO FORUMALARIO.. ****** VERIFICAR MELHOR context = { "name": self.cleaned_data['name'], "email": self.cleaned_data['email'], "message": self.cleaned_data['message'] } template_name = 'courses/contact_email.html' # COMANDO PADRONIZADO PARA ENVIAR EMAIL. send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
def send_mail(self, course): subject = '[%s] contato ' % course #[%s] forma de formatação de mensagens strings em Python (não nomeada lista) # desnecesssario. utilizando o template message = 'Nome: %(name)s; E-mail: %(email)s;%(message)s' # %(name)s forma de formatação de mensagens strings em Python (nomeada dicionartio) 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 de e-mail pelo renderizando um template
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 = 'registration/password_reset_mail.html' subject = 'Criar nova senha no Simple MOOC' context = {'reset': reset} send_mail_template(subject=subject, template_name=template_name, context=context, recipient_list=[user.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() subject = 'Criar nova senha no Simple MOOC' template_name = 'accounts/password_reset_email.html' context = { 'reset': reset, 'domain': settings.EMAIL_LINK_DOMAIN } send_mail_template(subject, template_name, context, [user.email])
def send_mail(self, course): """ Definindo envio de email """ subject = f'[{course}] | Contato' # Enviando email usando template (criado em core/mail.py) send_mail_template( subject, 'courses/contact_email.html', self.cleaned_data, [settings.CONTACT_EMAIL] )
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'], } #message = message % context #send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [settings.CONTACT_EMAIL]) template_name = 'courses/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'] ) #o .get é um filer que retorna apenas obejetos, se não retornar nada é gerada um execção 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 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 ])
def save(self): user = User.objects.get(email=self.cleaned_data['email']) key = generate_hash_key(user.email) reset = PasswordReset(user=user, key=key) reset.save() template_name = 'accounts/password_reset_mail.html' subject = 'Criar Nova senha no simple mooc' context = {'reset': reset} send_mail_template(subject=subject, template_name=template_name, context=context, recipient_list=[user.email])
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])
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)
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 template_name = 'courses/contact_email.html' #Utilizando email de usuário cadastrado mailto = self.cleaned_data['email'] #send_mail(subject,message,settings.DEFAULT_FROM_EMAIL,[mailto]) send_mail_template(subject, template_name, context, [mailto])
def save(self): user = User.objects.get(email=self.cleaned_data['email']) key = generate_hash_key( user.username ) # Gera a chave passando o username como salt e atribui a key reset = PasswordReset(key=key, user=user) # Recebe a chave já criptogravada 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): ''' Resposansavél pelo envio de email ''' subject = '[%s] Contato' % course context = { 'nome': self.cleaned_data['nome'], 'email': self.cleaned_data['email'], 'message': self.cleaned_data['message'] } template_name = 'courses/contact_email.html' #message = message % context send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])
def send_email(self, course): subject = '[%s] Contato' % course # Título da menssagem, "assunto" context = { # tupla definida para implementar e menssagem 'name': self.cleaned_data['name'], 'email': self.cleaned_data['email'], 'message': self.cleaned_data['message'] } send_mail_template( # esta função irá enviar um email automático definido acima, muitas possibilidades. subject, 'courses/contact_email.html', context, [settings.CONTACT_EMAIL] )
def send_mail(self, course): subject = '[{}] Contato'.format(course) context = { 'name': self.cleaned_data['name'], 'email': self.cleaned_data['email'], 'msg': self.cleaned_data['message'] } to = [settings.CONTACT_EMAIL] template_name = 'courses/mail.html' send_mail_template(subject=subject, template_name=template_name, context=context, recipient_list=to)
def send_mail(self, course): subject = '[%s] Contato ' % course #message = 'Nome: %(name)s; E-mail: %(email)s; %(message)s' #Criado o contexto atribuindo valor para as variaveis nomeadas context = { 'name': self.cleaned_data['name'], 'email': self.cleaned_data['email'], 'message': self.cleaned_data['message'], } #aplicando o contexto a menssagem criada. #message = message % context #send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [settings.CONTACT_EMAIL]) template_name = 'courses/contact_email.html' send_mail_template( subject, template_name, context, [settings.CONTACT_EMAIL] )
def send_mail(self, course): subject = '[%s] Contato' % course #message = 'Nome: %(name)s; Email: %(email)s; Mensagem: %(message)s' ##message = 'Nome: %s; Email: %s; Mensagem: %s' #Forma sem nomeação é passada uma lista. Com nomeação (linha acima) é passado um dicionário 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] #) template_name = 'courses/contact_email.html' send_mail_template(subject, template_name, context, [settings.CONTACT_EMAIL])