This is my email, i have two buttons, one for cool water and one for hot water, i want like push cool water 10 times it send email, like push hot water 5 times to send email.Email working but like push cool button 5 times it send email, but after that like push buton hot only once it again send email, how i can fix this ,.Thank your help
def Send_Email(email, password, to, subject, message): try: # Only for gmail account. with smtplib.SMTP('mail.xxxxxxxx.net:26') as server: server.ehlo() # local host server.starttls() # Puts the connection to the SMTP server. # login to the account of the sender server.login(email, password) # Format the subject and message together message = 'Subject: {}\n\n{}'.format(subject, message) # Sends the email from the logined email to the receiver's email server.sendmail(email, to, message) print('Email sent') except Exception as e: print("Email failed:",e) show_press = Label(master, text='You pressed the Button 0 times') show_press.pack() ##################### count = 0 def b1m(): ##this is name cool button global count count+=1 if count >= 5: # Code to be executed when "water is low" message = "adress ." Send_Email( email='@.net', # from account password='xxxxxx', #Its password to =("c@c"), # Receiver's email subject='water IS LOW PLEASE CHARGE1', # Subject of mail message=message ) # The message you want show_press['text'] = 'You pressed the Button {} times'.format(count) #end email count = 0 def b2m(): #name second hot button global count count+=1 if count >= 3: # Code to be executed when "water is low" message = "adress." Send_Email2( email='@', # from account password='xxxxx', #Its password to =("@" ), # Receiver's email subject='water IS LOW PLEASE CHARGE2', # Subject of mail message=message ) # The message you want show_press['text'] = 'You pressed the Button {} times'.format(count)