Error while sending mail on new setup

Hi all,

I’m getting the following error while trying to send emails on my new ERPNext v5 setup.
I have installed it as documented here:

I guess I’m missing some dependency, but not sure what ?
Any suggestions ? Do I need to set up postfix or some mail server ?

Traceback (innermost last):
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/", line 51, in application
    response = frappe.handler.handle()
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/", line 69, in handle
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/", line 92, in execute_cmd
    ret =, **frappe.form_dict)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/", line 751, in call
    return fn(*args, **newargs)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/core/doctype/communication/", line 259, in make
    comm.send(print_html, print_format, attachments, send_me_a_copy=send_me_a_copy, recipients=recipients)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/core/doctype/communication/", line 54, in send
    self.notify(print_html, print_format, attachments, recipients)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/core/doctype/communication/", line 75, in notify
    self.prepare_to_notify(print_html, print_format, attachments)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/core/doctype/communication/", line 111, in prepare_to_notify
    print_format=print_format, html=print_html))
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/", line 970, in attach_print
    "fcontent": get_print(doctype, name, print_format=print_format, style=style, html=html, as_pdf=True)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/", line 953, in get_print
    return get_pdf(html)
  File "/opt/erpnext5/frappe-bench/apps/frappe/frappe/utils/", line 32, in get_pdf
    pdfkit.from_string(html, fname, options=options or {})
  File "/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/", line 68, in from_string
    return r.to_pdf(output_path)
  File "/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/", line 119, in to_pdf
    raise IOError("wkhtmltopdf exited with non-zero code {0}. error:\n{1}".format(exit_code, stderr.decode("utf-8")))
 IOError: wkhtmltopdf exited with non-zero code 1. error:
Unknown long argument --background

  wkhtmltopdf 0.9.9

  wkhtmltopdf [OPTIONS]...  [More input files] 
  Converts one or more HTML pages into a PDF document, *not* using wkhtmltopdf
  patched qt.

General Options:
      --collate                       Collate when printing multiple copies
      --copies                Number of copies to print into the pdf                                      file (default 1)
      --extended-help                 Display more extensive help, detailing                                      less common command switches
  -h, --help                          Display help
  -O, --orientation      Set orientation to Landscape or Portrait
  -s, --page-size               Set paper size to: A4, Letter, etc.
      --password            HTTP Authentication password
  -p, --proxy                  Use a proxy
  -q, --quiet                         Be less verbose
      --username            HTTP Authentication username
  -V, --version                       Output version information an exit
Reduced Functionality:
  This version of wkhtmltopdf has been compiled against a version of QT without
  the wkhtmltopdf patches. Therefore some features are missing, if you need
  these features please use the static version.

  Currently the list of features only supported with patch QT includes:

 * Printing more then one HTML document into a PDF file.
 * Running without an X11 server.
 * Adding a document outline to the PDF file.
 * Adding headers and footers to the PDF file.
 * Generating a table of contents.
 * Adding links in the generated PDF file.
 * Printing using the screen media-type.
 * Disabling the smart shrink feature of webkit.

  If you experience bugs or want to request new features please visit 
  , if you have any problems
  or comments please feel free to contact me: see
  1. did you set up the email accounts on your erp?
  2. try updating your bench.
1 Like

Hi jix,

cd /opt/erpnext5/frappe-bench
bench update

Seems to have done the trick. Thanks !

cool! you don’t even need to go to the actual directory
“bench update” will be enough