Email messages hanging in the queue for a long time

Hi guys,

We recently noticed quite a weird behavior of the email messages our custom app places to the email queue. When the script generates a new email, it hangs in the queue for a long time (many hours, almost indefinite) without any action, remaining in “Not Sent” status.

The email is well formed and is visible via the Queue Manager interface in ERP Next:

When we manually select such a message and press Send Now button, it goes out in a good manner, reaching the email box of a recipient quickly.

We observe such issues on both the development VM with one of the latest ERP Next 7.1.x versions and on a more powerful server where we deploy ERP Next manually ourselves.

Just in case, below are captured our email messaging settings in ERP Next setup:

Does anybody have any idea on how to fix this?

Thank you.

George

P.S. Just in case, we also provide the source of one of the emails affected by this problem:

indent preformatted text by 4 spacesContent-Type: multipart/mixed; boundary="===============2070737609=="
MIME-Version: 1.0
From: romanchuk.katerina@gmail.com
X-Frappe-Site: http://erpnext.vm
CC:
To: romanchuk.katerina@gmail.com
Date: Mon, 21 Nov 2016 09:57:24 -0000
Reply-To: romanchuk.katerina@gmail.com
Subject: Status update for shipment [6d93a2aaaf]on erpnext.vm

–===============2070737609==
Content-Type: multipart/alternative; boundary="===============1900835415=="
MIME-Version: 1.0

–===============1900835415==
Content-Type: text/plain; charset=“utf-8”
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

TEST

Sent via ERPNext

–===============1900835415==
Content-Type: text/html; charset=“utf-8”
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Status update for shipment [6d93a2aaaf]on erpnext.vm
TEST =
--===============1900835415==--

–===============2070737609==–
indent preformatted text by 4 spaces

Seems weird. Check the Error Log for clues.

Nothing suspicious detected in the logs so far … We will keep watching this problem. When it is reproduced once again, we will be sharing more context and error log traps.

Hi @gvyshnya,

Did you ever get to the bottom of this problem? We are experiencing something similar.

Regards,
CKSGB

@Chude_Osiegbu: unfortunately we could find the root cause of the problem.

We keep watching it on our side - if this is observed once again, we will try to collect more detailed logs/error traps.

If you have the issues on your end, please share our error log details (if any). It could help the crew at Frappe to look at more details on it.

Hi @gvyshnya,

did you happen to resolve this issue? We are experiencing a similar issue where the email queue is on (shows “Suspend sending”), but mails just hang there. Sending them manually works fine (Queue > Send Now).

Our setup is: Debian 9 VM, ERPNext from easy install script v12, as site1.local (no multitenancy).

$ bench doctor

Shows 3 workers online, no jobs for site1.local

$ bench --site all enable-scheduler

did not change anything.

According to Email Queue Processing I found in logs/worker.error.log

17:43:15 default: frappe.utils.background_jobs.execute_job(event='sendmail', is_                                     async=True, job_name='<function sendmail at 0x7f4628203d08>', kwargs={'cc': [],  ... })  (2149ee98-1fa8-403d-9ef0-9af403adf619)
WARNING Property: Unknown Property name. [11:3: overflow-wrap]
17:43:15 default: Job OK (2149ee98-1fa8-403d-9ef0-9af403adf619)

Still it says, job OK… But does not get sent…

If I brute-force mail sending using crontab (see V11 can't suspend nor resume email queue) with

$ sudo crontab -e
* * * * * cd /home/frappe/frappe-bench && /usr/local/bin/bench execute frappe.email.queue.flush

it will not allow to send attached pdfs (see V12 error on sending email with document pdf)

Any inputs are welcome…

@lasalesi Have you find the fix? I got the same issue

No, actually only the workaround as posted above by force-sending…

As my observed that an email queue posts transaction in the communication list. I reset permission of communication list and working fine.