Why does blynk not working proper after an email is send

Why blynk is not working proper after an email is send out, i cannot control the sensor example like on/off fan,on/off light, but sensor dht-11 still can working as it keep updating the data to my blynk.
raspberry pi 3 + internet
Android
Blynk server


from gpiozero import LED
import RPi.GPIO as GPIO
import BlynkLib
import time
import Adafruit_DHT
import sys
from blynktimer import Timer
import os
import glob
import picamera
import smtplib
import sys, errno
from datetime import datetime

BLYNK_AUTH = 'Ot1KsMauBKoTdiY3CWF3l4OjTlXF3HhI'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
timer = Timer()


#import modules for sending mail
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders

sender = 'dmmmmm0724@gmail.com'
password = 'xxxxxxxxx'
receiver = 'dm.8718@hotmail.com'

DIR = './Visitors/'
prefix = 'image'



GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)#Button to GPIO26
#GPIO.setup(26, GPIO.IN)  #read output from button sensor


#setup pin
led1 = LED(18)
fan = LED(19)
sensor_type = Adafruit_DHT.DHT11
sensor_pin = 4
servoPIN = 22
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(servoPIN, GPIO.OUT)
GPIO.setup(17, GPIO.IN) #gas
GPIO.setup(21, GPIO.IN) #flame
p = GPIO.PWM(servoPIN, 50) # GPIO 17 for PWM with 50Hz
p.start(5) # Initialization
GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)#Button to GPIO26
GPIO.setup(20, GPIO.IN)# rip


#motor setup
stepper_pins=[23,24,25,5]

GPIO.setup(stepper_pins,GPIO.OUT)

stepper_sequence=[]
stepper_sequence.append([GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.LOW])
stepper_sequence.append([GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.LOW])
stepper_sequence.append([GPIO.LOW, GPIO.HIGH, GPIO.LOW, GPIO.LOW])
stepper_sequence.append([GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW])
stepper_sequence.append([GPIO.LOW, GPIO.LOW, GPIO.HIGH, GPIO.LOW])
stepper_sequence.append([GPIO.LOW, GPIO.LOW, GPIO.HIGH, GPIO.HIGH])
stepper_sequence.append([GPIO.LOW, GPIO.LOW, GPIO.LOW, GPIO.HIGH])
stepper_sequence.append([GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.HIGH])

#ultrasonic
led = 15
echo = 13
trig = 12

GPIO.setup(echo , GPIO.IN)
GPIO.setup(led , GPIO.OUT)
GPIO.setup(trig, GPIO.OUT)

# Register Virtual Pins of led
@blynk.VIRTUAL_WRITE(1)
def my_write_handler(value):
  print('Current V1 value: {}'.format(value[0]))
  if int(format(value[0])) == 1:
    led1.on()
  else:
    led1.off()
    

# Register Virtual Pins of fan
@blynk.VIRTUAL_WRITE(5)
def my_write_handler(value):
  print('Current V5 value: {}'.format(value[0]))
  if int(format(value[0])) == 1:
    fan.on()
  else:
    fan.off()
    
# Register Virtual Pins of gate
@blynk.VIRTUAL_WRITE(6)
def my_write_handler(value):
  if int(format(value[0])) == 1:
    p.ChangeDutyCycle(5)
    time.sleep(0.5)
    p.ChangeDutyCycle(10)
    time.sleep(0.5)
    print("GATE OPEN")
  else:
    p.ChangeDutyCycle(10)
    time.sleep(0.5)
    p.ChangeDutyCycle(5)
    time.sleep(0.5)
    print("GATE CLOSE")
    
# Register Virtual Pins of temperature and humidity
@timer.register(interval=5)
def my_user_task():
    humidity, temperature = Adafruit_DHT.read_retry(sensor_type, sensor_pin)
    print('Humidity = {:.2f}%\tTemperature = {:.2f}C'.format(humidity, temperature))
    blynk.virtual_write(3, '{:.2f}'.format(temperature))
    blynk.virtual_write(4, '{:.2f}'.format(humidity))
    if temperature >= 30.0:
        GPIO.output(19, GPIO.HIGH)
        print('Fan on')       
    blynk.run()

# flame and gas detecton function
@timer.register(interval=1)
def flameGas():
        if GPIO.input(17) == 1:
         print("gAs detected")
         blynk.notify('Gas Leakage')
         time.sleep(0.2)
        elif GPIO.input(21) == 0:
         print("flame detected")
         blynk.notify('Fire,go back home now')
         time.sleep(0.2)



def send_mail(filename):
    msg = MIMEMultipart()
    msg['From'] = sender
    msg['To'] = receiver
    msg['Subject'] = 'Visitor'
    
    body = 'Someone is visit your house'
    msg.attach(MIMEText(body, 'plain'))
    attachment = open(filename, 'rb')
    part = MIMEBase('application', 'octet-stream')
    part.set_payload((attachment).read())
    encoders.encode_base64(part)
    part.add_header('Content-Disposition', 'attachment; filename= %s' % filename)
    msg.attach(part)
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login(sender, password)
    text = msg.as_string()
    server.sendmail(sender, receiver, text)
    server.quit()
    print('Sending email')
    BLYNK_AUTH = 'Ot1KsMauBKoTdiY3CWF3l4OjTlXF3HhI'
    blynk = BlynkLib.Blynk(BLYNK_AUTH)


def capture_img():
    print('Capturing')
    if not os.path.exists(DIR):
        os.makedirs(DIR)
    files = sorted(glob.glob(os.path.join(DIR, prefix + '[0-9][0-9][0-9].jpg')))
    count = 0
    
    if len(files) > 0:
        count = int(files[-1][-7:-4])+1
    filename = os.path.join(DIR, prefix + '%0GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)#Button to GPIO263d.jpg' % count)
    with picamera.PiCamera() as camera:
        pic = camera.capture(filename)
    send_mail(filename)

def send_mailPassby(filename):
    msg = MIMEMultipart()
    msg['From'] = sender
    msg['To'] = receiver
    msg['Subject'] = 'Visitor'
    
    body = 'Someone is visit your house'
    msg.attach(MIMEText(body, 'plain'))
    attachment = open(filename, 'rb')
    part = MIMEBase('application', 'octet-stream')
    part.set_payload((attachment).read())
    encoders.encode_base64(part)
    part.add_header('Content-Disposition', 'attachment; filename= %s' % filename)
    msg.attach(part)
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login(sender, password)
    text = msg.as_string()
    server.sendmail(sender, receiver, text)
    server.quit()
    print('Sending email')

def capture_imgPassby():
    print('Capturing')
    if not os.path.exists(DIR):
        os.makedirs(DIR)
    files = sorted(glob.glob(os.path.join(DIR, prefix + '[0-9][0-9][0-9].jpg')))
    count = 0
    
    if len(files) > 0:
        count = int(files[-1][-7:-4])+1
    filename = os.path.join(DIR, prefix + '%0GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)#Button to GPIO263d.jpg' % count)
    with picamera.PiCamera() as camera:
        pic = camera.capture(filename)
    send_mailPassby(filename)

#@timer.register(interval=1)
def camera():
    i = GPIO.input(26)
    if i == False:  
        print ("Someone is visiting your house", i)
        capture_img()
#    elif GPIO.input(20):
#        print('People Passby')
#        capture_imgPassby()



def motor():
    hha = datetime.now().strftime('%H:%M:%S')
    if(hha  =='13:56:00'):
        while(True):
            for row in reversed (stepper_sequence):
                for row in stepper_sequence:
                    GPIO.output(stepper_pins,row)
                    time.sleep(0.001)
                hha2 = datetime.now().strftime('%H:%M:%S')
            if (hha2 == '13:56:10'):
                    print('close')
                    break
                
def ultrasonic():
    GPIO.output(trig ,True)
    time.sleep(0.00001)
    GPIO.output(trig ,False)
    while GPIO.input(echo)== 0:
        srt = time.time()
    while GPIO.input(echo) == 1:
        end = time.time()
    duration = end - srt
    distance_cm = duration/0.000058
#    print('distance : {}cm' .format(distance_cm))
    time.sleep(3)
    
    if distance_cm <= 30:
        GPIO.output(led , GPIO.HIGH)
        
    else :
        GPIO.output(led , GPIO.LOW)

try:
    while True:
        blynk.run()
        timer.run()
        motor()
        ultrasonic()
        camera()

except KeyboardInterrupt:
    sys.exit(0)
    GPIO.cleanup()


It is not wise to put your auth code in code snippets you post . I doubt many people in here will mess with your project but its a bad habit and you should remove it.

I use Blynk with the standard C so I can’t help you with your python issue sorry