hello,
I am trying to get my function out of the loop and avoid sending multiples emails.
than you
I am trying to get my function out of the loop and avoid sending multiples emails.
def courriel():
print("intruder!")
try:
server= smtplib.SMTP("smtp.mailtrap.io", 2525)
server.login("096477fce46f57", "49f784782bcc12")
server.sendmail(sender, receiver, message)
print('Courriel envoy�')
except smtplib.SMTPException:
print("Impossible d'envoyer le courriel � " + receiver)
except (smtplib.socket.error, smtplib.SMTPConnectError):
print("Connexion impossible au serveur SMTP")
while(True):
if GPIO.input(bouton_alert_Del1)==0:
if led_off1==False:
print("Le syst�me d'alarme est activ�")
delai()
GPIO.output(DEL1,True)
led_off1=True
sleep(.5)
else:
print('Vous avez 10 secondes pour entrer votre code!')
decompte(int(t))
print("Le syst�me d'alarme est d�sactiv�")
GPIO.output(DEL1,False)
GPIO.output(DEL2,False)
led_off1=False
sleep(.5)
if GPIO.input(senseur_Del2)==1 and GPIO.input(bouton_alert_Del1)==1:
if led_off1==True:
GPIO.output(DEL2,True)
time.sleep(.2)
GPIO.output(DEL2,False)
time.sleep(.2)
led_off2=True
sleep(.5)
courriel() //dont want emails to be sent repeatedly without stoping the program just one time
else:
GPIO.output(DEL2,False)
led_off2=True
sleep(.5)any ideathan you
