Error in sending mail with attachment

I am unable to send email, with attaching document. I get the below error. But if manually go in the emailqueue and press the send now button, no error is thrown and everything working normal as it is.

Traceback (most recent call last):
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 167, in send
    message = ctx.build_message(recipient.recipient)
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 315, in build_message
    message = self.include_attachments(message)
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 392, in include_attachments
    print_format_file = frappe.attach_print(**attachment)
  File "apps/frappe/frappe/__init__.py", line 2232, in attach_print
    else get_print(doctype, name, **kwargs)
  File "apps/frappe/frappe/__init__.py", line 2191, in get_print
    return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
  File "apps/frappe_pdf/frappe_pdf/__init__.py", line 12, in pdf
    return get_pdf(*args, **kwargs)
  File "apps/frappe/frappe/utils/pdf.py", line 90, in get_pdf
    filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
  File "env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string
    return r.to_pdf(output_path)
  File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
    self.handle_error(exit_code, stderr)
  File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: HostNotFoundError


And to add I’m getting the above error after I installed the below version of wkhtmltopdf

wkhtmltopdf 0.12.6.1 (with patched qt)

Before that I’m getting the below error

Traceback (most recent call last):
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 167, in send
    message = ctx.build_message(recipient.recipient)
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 315, in build_message
    message = self.include_attachments(message)
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 392, in include_attachments
    print_format_file = frappe.attach_print(**attachment)
  File "apps/frappe/frappe/__init__.py", line 2232, in attach_print
    else get_print(doctype, name, **kwargs)
  File "apps/frappe/frappe/__init__.py", line 2191, in get_print
    return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
  File "apps/frappe_pdf/frappe_pdf/__init__.py", line 12, in pdf
    return get_pdf(*args, **kwargs)
  File "apps/frappe/frappe/utils/pdf.py", line 90, in get_pdf
    filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
  File "env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string
    return r.to_pdf(output_path)
  File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
    self.handle_error(exit_code, stderr)
  File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
The switch --print-media-type, is not support using unpatched qt, and will be ignored.The switch --disable-smart-shrinking, is not support using unpatched qt, and will be ignored.QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 1001, but a directory permissions 0700 owned by UID 1000 GID 1000
Exit with code 1 due to network error: HostNotFoundError


Can anyone help me with this?

Thanks in Advance!