Why erpnext take about 5 minutes to send email

thank you for your replay if i changed it to 10 would it take more resources ?
my ram is 4g and erp take about 90%

Likely yes, since units are seconds and default is 300!

Be aware for eg with gmail a poll interval of less than 15 minutes and gmail will ignore your login to check for mail

2 Likes

thanks i use my own mail server

Check this for an idea of jobs governed by schedule_interval

frappe@erpnext:~/frappe-bench$ less logs/worker.error.log

1 Like

Hi clarkej,
I want to ask you ,
Can we change the scheduler_interval time as per our requirement?

i make this immediately after i click on the condition like save ,submit etc as per the Send Alert On that doctype

With a self-hosted environment yes you are welcome to experiment for yourself…

1 Like

Normally emails are queued in Email Queue . If you want to send it directly without queuing.
Just pass one extra flag/parameter to send() method
i.e. delayed=False
it will sent immediately after click send

1 Like

Maybe this helps:

Hi. Can you please tell me where to go to do this?

1 Like

How to change this for site in frappe. Cloud

Please, how to implement this?

Till today Frappe is taking minutes for sending out a E-Mail which is not acceptable.
There seems to be no frontend setting to configure e sending delay or queue priority.
That is needed urgently.

Just search for email queue list, then pick your email and click on send.

This is a big chore when you have hundreds of mails queued to send.

I dont think that. If I send mass mail, I have more than 5 minutes. Bc I need to prepare. If I have to send one urgent mail I can click on it in the queue.

It works for me and I don’t know a better solution. But we are all different.

ps: If you send more than one different email, the scheduler will send them together, so you dont have to wait 5 minutes for each.

You are correct: this cannot be changed from the front end. It can only be changed on the backend.

The schedule is defined in the “hooks.py” file for Frappe Framework (link here)

  • The function 'frappe.email.queue.flush' processes all the emails in the Email Queue.
  • The “all” schedule is configured via a JSON file. But by default, it’s every 4-5 minutes. (very confusing name for a schedule)

So. Let’s say we want our emails processed every 2 minutes instead? You could delete that line from “hooks.py”, and add your own. See my example below, using cron syntax.

3 Likes

Yes manually going inside the queue is definately not a option. Because most emails are being sent in a automated matter as a result of actions made inside and outside of the ERPNext Instance.

@brian_pond Yes editing the source code is also not the sleekest option as it would affect the update workflow and needs additional git stashing settings which were always problematic with erpnext in my past experience.

Is there not a option to solve that via a server script or similar? So no manual action is required, nore editing any source code of frappe/erpnext.

1 Like

I’d really love to see the possibility to send mails immediately.
delayed=False” in the function of a special button maybe?

how can we archive the same thing for notification email alert

You could write a scheduler Server Script to flush the email queue on any occation that you wish.

Check scheduler_tick_interval value on site_config.json
https://frappeframework.com/docs/user/en/basics/site_config