Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

40 rindas
1.4 KiB

  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import webnotes
  5. from webnotes import conf
  6. def sendmail_md(recipients, sender=None, msg=None, subject=None):
  7. """send markdown email"""
  8. import markdown2
  9. sendmail(recipients, sender, markdown2.markdown(msg), subject)
  10. def sendmail(recipients, sender='', msg='', subject='[No Subject]'):
  11. """send an html email as multipart with attachments and all"""
  12. from webnotes.utils.email_lib.smtp import get_email
  13. get_email(recipients, sender, msg, subject).send()
  14. def sendmail_to_system_managers(subject, content):
  15. from webnotes.utils.email_lib.smtp import get_email
  16. get_email(get_system_managers(), None, content, subject).send()
  17. @webnotes.whitelist()
  18. def get_contact_list():
  19. """Returns contacts (from autosuggest)"""
  20. cond = ['`%s` like "%s%%"' % (f,
  21. webnotes.form_dict.get('txt')) for f in webnotes.form_dict.get('where').split(',')]
  22. cl = webnotes.conn.sql("select `%s` from `tab%s` where %s" % (
  23. webnotes.form_dict.get('select')
  24. ,webnotes.form_dict.get('from')
  25. ,' OR '.join(cond)
  26. )
  27. )
  28. webnotes.response['cl'] = filter(None, [c[0] for c in cl])
  29. def get_system_managers():
  30. return webnotes.conn.sql_list("""select parent FROM tabUserRole
  31. WHERE role='System Manager'
  32. AND parent!='Administrator'
  33. AND parent IN
  34. (SELECT email FROM tabProfile WHERE enabled=1)""")