Email Scheduler not Working properly. Try this python code

def email_queue_send_now():
    data = frappe.get_list('Email Queue', filters={'Status': 'Not Sent'})
    for email in data:
        # print(

I wrote this code and its working as expected for me. Please correct me if there is any simple way to do this.

I tried enable scheduler but its not working so I have done this as an alternative.
I think it can be added to hooks all event so that this can be called every 4 mins.
Didn’t try but I think it should work.