Advertisement
Guest User

Untitled

a guest
Mar 7th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. @staticmethod
  2. def make_email_config(assunto, email):
  3. empresa = ModelParametros.get_instance()
  4. return EmailMultiAlternatives(
  5. connection=get_connection(
  6. host=empresa.serveremail_host,
  7. port=empresa.serveremail_port,
  8. username=empresa.serveremail_user,
  9. password=empresa.serveremail_password,
  10. fail_silently=False
  11. ),
  12. from_email=empresa.email_rh,
  13. to=[email],
  14. subject=assunto
  15. )
  16.  
  17. @staticmethod
  18. def enviar_email(assunto, email_destino, mensagem_html, tipo='text/html'):
  19. email = ModelParametros.make_email_config(assunto, email)
  20. email.attach_alternative(mensagem_html, tipo)
  21. email.send(fail_silently=False)
  22.  
  23. ModelParametros.enviar_email("Nova senha GCAWEB", email, mensagem_html)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement