I am not able to send email, attaching document print.
I get the below error. But when I manually go in the email queue and press the send now button, no error is thrown and everything is normal.
Traceback with variables (most recent call last):
File "apps/frappe/frappe/utils/background_jobs.py", line 188, in execute_job
retval = method(**kwargs)
site = 'ath1.prod'
method = <function send_mail at 0x7f939a1b68c0>
event = None
job_name = 'email_queue_sendmail_241'
kwargs = {'email_queue_name': 241, 'is_background_task': True}
user = 'Administrator'
is_async = True
retry = 0
retval = None
method_name = 'send_mail'
before_job_task = 'frappe.monitor.start'
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 185, in send_mail
record.send(is_background_task=is_background_task, smtp_server_instance=smtp_server_instance)
email_queue_name = 241
is_background_task = True
smtp_server_instance = None
record = <EmailQueue: 241>
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 136, in send
message = ctx.build_message(recipient.recipient)
self = <EmailQueue: 241>
is_background_task = True
smtp_server_instance = None
ctx = <frappe.email.doctype.email_queue.email_queue.SendMailContext object at 0x7f939a0e3a00>
message = None
recipient = <EmailQueueRecipient: ccea2c40de parent=241>
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 294, in build_message
message = self.include_attachments(message)
self = <frappe.email.doctype.email_queue.email_queue.SendMailContext object at 0x7f939a0e3a00>
recipient_email = '17ucs104@lnmiit.ac.in'
message = 'Content-Type: multipart/mixed; boundary="===============7923141638298358434=="\r\nMIME-Version: 1.0\r\nMessage-Id: <169365734169.1424.12709423314810752654@ath1.prod>\r\nX-Original-From: Administrator <amarratvaknitwearsonline@gmail.com>\r\nSubject: Delivery Note: DN-23-00566-1\r\nFrom: Administrator <amarratvaknitwearsonline@gmail.com>\r\nTo: 17ucs104@lnmiit.ac.in\r\nDate: Sat, 02 Sep 2023 12:22:21 -0000\r\nReply-To: amarratvaknitwearsonline@gmail.com\r\nX-Frappe-Site: https://athleticclassic.in\r\n\r\n--===============7923141638298358434==\r\nContent-Type: multipart/alternative; boundary="===============0272643487399464653=="\r\nMIME-Version: 1.0\r\n\r\n--===============0272643487399464653==\r\nContent-Type: text/plain; charset="utf-8"\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\ntest\r\n\r\n [View this in your browser](https://athleticclassic.in/Delivery\r\nNote/DN-23-00566-1?format=3DTally%20DC%20With%20Rate&key=3Dc9f4224dd5c66eec=\r\n993a9bb10d)\r\n\r...
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 353, in include_attachments
print_format_file = frappe.attach_print(**attachment)
self = <frappe.email.doctype.email_queue.email_queue.SendMailContext object at 0x7f939a0e3a00>
message = 'Content-Type: multipart/mixed; boundary="===============7923141638298358434=="\r\nMIME-Version: 1.0\r\nMessage-Id: <169365734169.1424.12709423314810752654@ath1.prod>\r\nX-Original-From: Administrator <amarratvaknitwearsonline@gmail.com>\r\nSubject: Delivery Note: DN-23-00566-1\r\nFrom: Administrator <amarratvaknitwearsonline@gmail.com>\r\nTo: 17ucs104@lnmiit.ac.in\r\nDate: Sat, 02 Sep 2023 12:22:21 -0000\r\nReply-To: amarratvaknitwearsonline@gmail.com\r\nX-Frappe-Site: https://athleticclassic.in\r\n\r\n--===============7923141638298358434==\r\nContent-Type: multipart/alternative; boundary="===============0272643487399464653=="\r\nMIME-Version: 1.0\r\n\r\n--===============0272643487399464653==\r\nContent-Type: text/plain; charset="utf-8"\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\ntest\r\n\r\n [View this in your browser](https://athleticclassic.in/Delivery\r\nNote/DN-23-00566-1?format=3DTally%20DC%20With%20Rate&key=3Dc9f4224dd5c66eec=\r\n993a9bb10d)\r\n\r...
message_obj = <email.message.EmailMessage object at 0x7f9398ed65c0>
attachments = [{'print_format': 'Tally DC With Rate', 'html': '', 'doctype': 'Delivery Note', 'name': 'DN-23-00566-1', 'lang': 'en', 'print_letterhead': '1'}]
attachment = {'print_format': 'Tally DC With Rate', 'html': '', 'doctype': 'Delivery Note', 'name': 'DN-23-00566-1', 'lang': 'en', 'print_letterhead': '1'}
file_filters = {}
File "apps/frappe/frappe/__init__.py", line 2087, in attach_print
content = get_print(doctype, name, **kwargs)
doctype = 'Delivery Note'
name = 'DN-23-00566-1'
file_name = 'DN-23-00566-1'
print_format = 'Tally DC With Rate'
style = None
html = ''
doc = None
lang = 'en'
print_letterhead = '1'
password = ********
scrub_urls = <function scrub_urls at 0x7f939c8e9bd0>
print_settings = {'add_draft_heading': '1', 'allow_page_break_inside_tables': '0', 'allow_print_for_cancelled': '0', 'allow_print_for_draft': '1', 'compact_item_print': '0', 'creation': None, 'docstatus': '0', 'enable_print_server': '0', 'enable_raw_printing': '0', 'font': 'Default', 'font_size': '0', 'idx': '0', 'modified': '2023-08-17 18:10:12.852097', 'modified_by': 'Administrator', 'name': 'Print Settings', 'owner': 'Administrator', 'pdf_page_height': '0', 'pdf_page_size': 'A4', 'pdf_page_width': '0', 'print_style': 'Redesign', 'print_taxes_with_zero_amount': '0', 'print_uom_after_quantity': '1', 'repeat_header_footer': '0', 'send_print_as_pdf': '1', 'with_letterhead': '0'}
_lang = 'en'
no_letterhead = False
kwargs = {'print_format': 'Tally DC With Rate', 'style': None, 'html': '', 'doc': None, 'no_letterhead': False, 'password': '********', 'as_pdf': True}
content = ''
ext = '.pdf'
File "apps/frappe/frappe/__init__.py", line 2040, in get_print
return get_pdf(html, options=pdf_options, output=output)
doctype = 'Delivery Note'
name = 'DN-23-00566-1'
print_format = 'Tally DC With Rate'
style = None
html = '<!DOCTYPE html>\n<html lang="en" dir="ltr">\n<head>\n\t<meta charset="utf-8">\n\t<meta name="viewport" content="width=device-width, initial-scale=1.0">\n\t<title>Athletic Classic - Shree Triveni Agency</title>\n\t<meta name="generator" content="frappe">\n\t<link type="text/css" rel="stylesheet" href="/assets/frappe/dist/css/print.bundle.OGIJAILY.css">\n\t\n\t\t<style>\n\t\t@media screen {\n\t.print-format-gutter {\n\t\tbackground-color: #d1d8dd;\n\t\tpadding: 30px 0px;\n\t}\n\t.print-format {\n\t\tbackground-color: white;\n\t\tborder-radius: 8px;\n\t\tmax-width: 8.3in;\n\t\tmin-height: 11.69in;\n\t\tpadding: 0.75in;\n\t\tmargin: auto;\n\t\tcolor: var(--gray-900);\n\t}\n\n\t.print-format.landscape {\n\t\tmax-width: 11.69in;\n\t\tpadding: 0.2in;\n\t}\n\n\t.page-break {\n\t\t/* padding: 15px 0px; */\n\t\tborder-bottom: 1px dashed #888;\n\t}\n\n\t/* .page-break:first-child {\n\t\tpadding-top: 0px;\n\t} */\n\n\t.page-break:last-child {\n\t\tborder-bottom: 0px;\n\t}\n\n\t/* mozilla hack for...
as_pdf = True
doc = None
output = None
no_letterhead = False
password = ********
pdf_options = {}
letterhead = None
get_pdf = <function get_pdf at 0x7f939a3a64d0>
get_response_content = <function get_response_content at 0x7f93989b6440>
File "apps/frappe/frappe/utils/pdf.py", line 38, in get_pdf
filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
html = '<!DOCTYPE html>\n<html dir="ltr" lang="en"><head>\n\t<meta charset="utf-8"/>\n\t<meta content="width=device-width, initial-scale=1.0" name="viewport"/>\n\t<title>Athletic Classic - Shree Triveni Agency</title>\n\t<meta content="frappe" name="generator"/>\n\t<link href="http://ath1.prod/assets/frappe/dist/css/print.bundle.OGIJAILY.css" rel="stylesheet" type="text/css"/>\n\t\n\t\t<style>\n\t\t@media screen {\n\t.print-format-gutter {\n\t\tbackground-color: #d1d8dd;\n\t\tpadding: 30px 0px;\n\t}\n\t.print-format {\n\t\tbackground-color: white;\n\t\tborder-radius: 8px;\n\t\tmax-width: 8.3in;\n\t\tmin-height: 11.69in;\n\t\tpadding: 0.75in;\n\t\tmargin: auto;\n\t\tcolor: var(--gray-900);\n\t}\n\n\t.print-format.landscape {\n\t\tmax-width: 11.69in;\n\t\tpadding: 0.2in;\n\t}\n\n\t.page-break {\n\t\t/* padding: 15px 0px; */\n\t\tborder-bottom: 1px dashed #888;\n\t}\n\n\t/* .page-break:first-child {\n\t\tpadding-top: 0px;\n\t} */\n\n\t.page-break:last-child {\n\t\tborder-bottom: 0px;\n\t}\n\n\t/...
options = {'print-media-type': None, 'background': None, 'images': None, 'quiet': None, 'encoding': 'UTF-8', 'margin-right': '15mm', 'margin-left': '15mm', 'header-html': '/tmp/frappe-pdf-41515135a6bb2a01b7e6c5e9596ffe7bfc636063f0310e7eda3d87a2.html', 'margin-bottom': '2mm', 'page-size': 'A4', 'disable-javascript': '', 'disable-local-file-access': '', 'disable-smart-shrinking': ''}
output = None
filedata = ''
File "env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string
return r.to_pdf(output_path)
input = '<!DOCTYPE html>\n<html dir="ltr" lang="en"><head>\n\t<meta charset="utf-8"/>\n\t<meta content="width=device-width, initial-scale=1.0" name="viewport"/>\n\t<title>Athletic Classic - Shree Triveni Agency</title>\n\t<meta content="frappe" name="generator"/>\n\t<link href="http://ath1.prod/assets/frappe/dist/css/print.bundle.OGIJAILY.css" rel="stylesheet" type="text/css"/>\n\t\n\t\t<style>\n\t\t@media screen {\n\t.print-format-gutter {\n\t\tbackground-color: #d1d8dd;\n\t\tpadding: 30px 0px;\n\t}\n\t.print-format {\n\t\tbackground-color: white;\n\t\tborder-radius: 8px;\n\t\tmax-width: 8.3in;\n\t\tmin-height: 11.69in;\n\t\tpadding: 0.75in;\n\t\tmargin: auto;\n\t\tcolor: var(--gray-900);\n\t}\n\n\t.print-format.landscape {\n\t\tmax-width: 11.69in;\n\t\tpadding: 0.2in;\n\t}\n\n\t.page-break {\n\t\t/* padding: 15px 0px; */\n\t\tborder-bottom: 1px dashed #888;\n\t}\n\n\t/* .page-break:first-child {\n\t\tpadding-top: 0px;\n\t} */\n\n\t.page-break:last-child {\n\t\tborder-bottom: 0px;\n\t}\n\n\t/...
output_path = None
options = {'print-media-type': None, 'background': None, 'images': None, 'quiet': None, 'encoding': 'UTF-8', 'margin-right': '15mm', 'margin-left': '15mm', 'header-html': '/tmp/frappe-pdf-41515135a6bb2a01b7e6c5e9596ffe7bfc636063f0310e7eda3d87a2.html', 'margin-bottom': '2mm', 'page-size': 'A4', 'disable-javascript': '', 'disable-local-file-access': '', 'disable-smart-shrinking': ''}
toc = None
cover = None
css = None
configuration = None
cover_first = False
verbose = True
r = <pdfkit.pdfkit.PDFKit object at 0x7f93981aa2c0>
File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
self.handle_error(exit_code, stderr)
self = <pdfkit.pdfkit.PDFKit object at 0x7f93981aa2c0>
path = None
args = ['/usr/bin/wkhtmltopdf', '--print-media-type', '--background', '--images', '--quiet', '--encoding', 'UTF-8', '--margin-right', '15mm', '--margin-left', '15mm', '--header-html', '/tmp/frappe-pdf-41515135a6bb2a01b7e6c5e9596ffe7bfc636063f0310e7eda3d87a2.html', '--margin-bottom', '2mm', '--page-size', 'A4', '--disable-javascript', '--disable-local-file-access', '--disable-smart-shrinking', '-', '-']
result = <Popen: returncode: 1 args: ['/usr/bin/wkhtmltopdf', '--print-media-type', '...>
input = b'<!DOCTYPE html>\n<html dir="ltr" lang="en"><head>\n\t<meta charset="utf-8"/>\n\t<meta content="width=device-width, initial-scale=1.0" name="viewport"/>\n\t<title>Athletic Classic - Shree Triveni Agency</title>\n\t<meta content="frappe" name="generator"/>\n\t<link href="http://ath1.prod/assets/frappe/dist/css/print.bundle.OGIJAILY.css" rel="stylesheet" type="text/css"/>\n\t\n\t\t<style>\n\t\t@media screen {\n\t.print-format-gutter {\n\t\tbackground-color: #d1d8dd;\n\t\tpadding: 30px 0px;\n\t}\n\t.print-format {\n\t\tbackground-color: white;\n\t\tborder-radius: 8px;\n\t\tmax-width: 8.3in;\n\t\tmin-height: 11.69in;\n\t\tpadding: 0.75in;\n\t\tmargin: auto;\n\t\tcolor: var(--gray-900);\n\t}\n\n\t.print-format.landscape {\n\t\tmax-width: 11.69in;\n\t\tpadding: 0.2in;\n\t}\n\n\t.page-break {\n\t\t/* padding: 15px 0px; */\n\t\tborder-bottom: 1px dashed #888;\n\t}\n\n\t/* .page-break:first-child {\n\t\tpadding-top: 0px;\n\t} */\n\n\t.page-break:last-child {\n\t\tborder-bottom: 0px;\n\t}\n\n\t...
stdout = b'%PDF-1.4\n%\xc3\xa2\xc3\xa3\n1 0 obj\n<<\n/Title ()\n/Creator (\xfe\xff\x00w\x00k\x00h\x00t\x00m\x00l\x00t\x00o\x00p\x00d\x00f\x00 \x000\x00.\x001\x002\x00.\x006)\n/Producer (\xfe\xff\x00Q\x00t\x00 \x005\x00.\x001\x005\x00.\x003)\n/CreationDate (D:20230902175245+05\'30\')\n>>\nendobj\n2 0 obj\n<<\n/Type /Catalog\n/Pages 3 0 R\n>>\nendobj\n4 0 obj\n<<\n/Type /ExtGState\n/SA true\n/SM 0.02\n/ca 1.0\n/CA 1.0\n/AIS false\n/SMask /None>>\nendobj\n5 0 obj\n[/Pattern /DeviceRGB]\nendobj\n8 0 obj\n<<\n/Type /XObject\n/Subtype /Image\n/Width 4000\n/Height 4000\n/BitsPerComponent 8\n/ColorSpace /DeviceGray\n/Length 9 0 R\n/Filter /FlateDecode\n>>\nstream\nx\x9c\xec\xddy\xa0\x8fu\xde\xf8\xff\xefLe\xdf\xf7}\xdf\xf7]v\xb2\x15\xb2\x87\xec\x11\xed\x92J\xd6("\xad\xdaC\x92\xa5\x88P"\x85B\x96\xec!\xfb\xbe\xef\x1c\xfb\xce\xf7w]\x9fsH3s\xdf\xbf\xbb\xefL73=\x1e\x7f:\xe7|\xce\x19\x07\xa7\xe7\xbc^\xd7\xfb\xfd\x7f\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...
stderr = "The switch --print-media-type, is not support using unpatched qt, and will be ignored.The switch --header-html, 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: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-frappe'\nExit with code 1 due to network error: HostNotFoundError\n"
exit_code = 1
File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
raise IOError('wkhtmltopdf reported an error:\n' + stderr)
exit_code = 1
stderr = "The switch --print-media-type, is not support using unpatched qt, and will be ignored.The switch --header-html, 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: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-frappe'\nExit with code 1 due to network error: HostNotFoundError\n"
stderr_lines = ["The switch --print-media-type, is not support using unpatched qt, and will be ignored.The switch --header-html, 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: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-frappe'", 'Exit with code 1 due to network error: HostNotFoundError']
builtins.OSError: wkhtmltopdf reported an error:
The switch --print-media-type, is not support using unpatched qt, and will be ignored.The switch --header-html, 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: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-frappe'
Exit with code 1 due to network error: HostNotFoundError