Email Not Working

I have Ubuntu v22.04.3 & have ERPNext v15.18.1 which was updated from v15.16.x today. I have never been able to get email to send or receive even though the email domain / ports are setup correctly. I have tried to send manually from the Communication…Inbox and sending invoices but even though they have the “sent” status, they never arrive. They are not in any junk/spam folder either. I ran a port monitor for the IMAP port using IPTRAF (similar program as Wireshark) and when sending email from ERPNext or sending to ERPNext from an outside source, no activity occurs on IMAP port 587 TLS or SMTP port 993/SSH which I can surmise is the reason for email not working. Ideas anyone?

Hii @Jon_AK

Check Emails in “Email Queue” and also Check RQ Job is Active or not ?

Yes, all the email is stuck in the queue. I did also check the RQ Job status & there aren’t any jobs created & says the scheduler is inactive. I did enable enable the scheduler using bench enable-scheduler as well.


Check this Post

email shows as sending now for 10 minutes but in reality, i do not believe it is sending as it has not arrived in the inbox I am monitoring. Waited another 10 minutes & a couple pieces of email changed to failed status so, I deleted all the email in the queue.
Created a new email with a invoice but the queue showed it as Not Sent. I selected the message & told it to Send Now which it actually did & I received it.
Is there a way to set ERPNext to send immediately?

Checkout this posts

Hate to say this but, email has refused to send out invoices again. Have done all of the scheduler commands including auto enabling it to start. It had been working…not 100% reliable but now it just quit altogether & email remains in the queue until it errors out. Looked for logs dealing with this but the error logs that were there did not seem to relate to email or the scheduler as the scheduler log was 0 bytes.
What is odd is if I manually compose email from the email inbox, it sends out ok.
This is the error message I discovered when opening the email from the queue list:

File “/home/admin/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/”, line 167, in send
message = ctx.build_message(recipient.recipient)
File “/home/admin/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/”, line 314, in build_message
message = self.include_attachments(message)
File “/home/admin/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/”, line 387, in include_attachments
print_format_file = frappe.attach_print(**attachment)
File “/home/admin/frappe-bench/apps/frappe/frappe/”, line 2175, in attach_print
else get_print(doctype, name, **kwargs)
File “/home/admin/frappe-bench/apps/frappe/frappe/”, line 2134, in get_print
return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
File “/home/admin/frappe-bench/apps/frappe/frappe/utils/”, line 89, in get_pdf
filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
File “/home/admin/frappe-bench/env/lib/python3.10/site-packages/pdfkit/”, line 75, in from_string
return r.to_pdf(output_path)
File “/home/admin/frappe-bench/env/lib/python3.10/site-packages/pdfkit/”, line 201, in to_pdf
self.handle_error(exit_code, stderr)
File “/home/admin/frappe-bench/env/lib/python3.10/site-packages/pdfkit/”, line 155, in handle_error
raise IOError(‘wkhtmltopdf reported an error:\n’ + stderr)

HI @Jon_AK:

Are you able to get PDF manually from an invoice?

First, I believed ERPNext automatically created a PDF when it was chosen to email the invoice. Is this not correct?
Second, Is saving it as a PDF then manually attaching it to a piece of email the only way? The whole thing was working yesterday after a few goarounds but was satisfied with how it was working. The only thing different between yesterday & today is I powered off the server due to a power outage from high winds but only did that so the UPS did not abruptly shut down the server.

In answer to your question, if I save the invoice as a pdf, it will send with the pdf attachment IF I manually create a email message from the Inbox.