mentor_mailer.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. '''Created Jan 30, 2023 deeejas'''
  2. # coding: UTF-8
  3. import yagmail
  4. import keyring
  5. from winmentor import WinMentor
  6. from winmentor import M_mailer
  7. from winmentor import Smslink
  8. m_list = {'CHRYSOPEEA BRANDING & DESIGN SRL': {'mail': 'deeejas@mail.com', 'phone': '0754694364'}
  9. # 'Drytec': ['zsofia.torok4@gmail.com', 'vtorok@gmail.com'],
  10. # 'Ergo': 'office@ergohr.eu',
  11. # 'German': ['info@germanstone.ro', 'flori.flamand@germanstone.ro', 'freemir@web.de'],
  12. # 'Kun': 'kun_g_tibor@yahoo.com',
  13. # 'Mathe': 'tudor.aciu@gmail.com',
  14. # 'Chrysopeea': ['cristina.stan@chrysopeea.com', 'sfeliciacristina@yahoo.com'],
  15. # 'Elegance': 'bolbagelu@yahoo.com',
  16. # 'KK Invest': ['office@kkinv.ro', 'katalin.betegh@kkinv.ro'],
  17. # 'Vibro': ['tamas_neda@yahoo.com', 'romania@vibrocomp.com'],
  18. # 'Webs': 'webs_srl@yahoo.com',
  19. # 'Taurus': 'cotinghiu_dan@yahoo.com'
  20. }
  21. exclude = ['ABRON',
  22. 'ASCOMVEL',
  23. 'ASDONAT',
  24. 'ASPRO',
  25. 'ASIONAG',
  26. 'ASIVP',
  27. 'ALPHA',
  28. 'ASOBS',
  29. 'BANXI',
  30. 'BREIS',
  31. 'COMELECT',
  32. 'ECOPROT',
  33. 'EVEREST',
  34. 'FLAUR',
  35. 'GBZPFA',
  36. 'JOART',
  37. 'LUXWIN',
  38. 'MATILAND',
  39. 'MOCAN',
  40. 'SCOM',
  41. 'TERHOV',
  42. 'UNION',
  43. 'RECYC']
  44. head = ['Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs']
  45. mentor = WinMentor()
  46. office = list(mentor.filtered_firmlist(headers=head, ban=exclude)) # generator
  47. yag = yagmail.SMTP('claudia.conta.ab@gmail.com') # oauth2_file='~/oauth2_creds.json'
  48. month_ = M_mailer.mentor_date
  49. mailer = M_mailer()
  50. taxes = mailer.tax_mailer(office, m_list, mentor, yag, month_, send=False)
  51. sms = Smslink(connectionid=keyring.get_password('smslink', 'Connection ID'),
  52. password=keyring.get_password('smslink', 'parola'))
  53. # resp = sms.send()
  54. # print(resp.text)
  55. for company, contact in m_list.items():
  56. for tax in taxes:
  57. # print(repr(tax))
  58. if company == tax.name:
  59. # print(repr(tax))
  60. sms.message = repr(tax)
  61. sms.to = contact['phone']
  62. print(sms.to, '\n', sms.message)
  63. # resp = sms.send()
  64. # print(resp.text)