Advertisement
Guest User

Untitled

a guest
Apr 14th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. # Send an Email if We are running Low
  2. def checkemail(self):
  3. import smtplib
  4.  
  5. global numbacomps
  6. global numbaphones
  7.  
  8. # Mail protocol function within a function Jose...
  9. def mail(self):
  10. # From and To Addresses
  11. fromaddr = 'AutoNote@equatemedia.com'
  12. toaddrs = 'tech@budgetvanlines.com'
  13.  
  14. # Credentials
  15. username = 'AutoNote@equatemedia.com'
  16. password = 'equatemedia1'
  17.  
  18. # Send Mail
  19. server = smtplib.SMTP('smtp.gmail.com:587')
  20. server.starttls()
  21. server.login(username, password)
  22. server.sendmail(fromaddr, toaddrs, msg)
  23. server.quit()
  24.  
  25. # Conditional Statements and mailing protocols
  26. if numbacomps < 3:
  27. msg = 'We are running low on Computer Headsets, Only %i remain. Please order more.' % numbacomps
  28. mail(self)
  29.  
  30. if numbaphones < 3:
  31. msg = 'We are running low on Phone Headsets, Only %i remain. Please order more.' % numbaphones
  32. mail(self)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement