Using V11.1.14 - with Python 3.5 - getting this SMTP error - for outbound emails with print / pdf attachments.
(501, b’Syntax error - line too long’)
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py”, line 425, in send_one
smtpserver.sess.sendmail(email.sender, recipient.recipient, encode(message))
File “/usr/lib/python3.5/smtplib.py”, line 883, in sendmail
raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (501, b’Syntax error - line too long’)
Appreciate any help / thoughts on how to resolve. Thanks.
Hi please confirm the error occurs only in the case of the pdf attachment and whether you are running a self-hosted environment thanks
Thanks for reaching out. Self hosted environment. Emails without attachment (and email with inline tables such as weekly digest, etc) are going through fine.
Problem occurs when system attempts to email a sales order notification upon submit with attach print checkbox selected (using default print format).
ok some suspect recent changes in https://github.com/frappe/frappe/commits/develop/frappe/email/queue.py
Most notably this fix https://github.com/frappe/frappe/pull/6586
Otherwise no error it seems that any pdf generate process is part of the problem, but confirm that? The general case converts an HTML document format I believe.
You can run wkhtmltopdf from a console for eg
Steps to install wkhtmltopdf with patched Qt (version 0.12.3) (for pdf generation)
As well wkhtmltopdf must have http access to the html file, and so the FQDN domain url must be specified in /etc/hosts and sites/exampledomain.com/site_config.json
Have wkhtmltopdf v0.12.3 (patched Qt) installed - was done by script.
PDF generation now works - thanks for the tips on adding the domain name to /etc/hosts and the site_config.json. Had not even realized was timing out before. Able to see / download PDF when clicking on the PDF button (under print icon for sales order document)
However when emailing same sales order with attach print checkmarked (and print set to be pdf under print format) - continue to get above frappe.email.queue.flush error - smtplib.SMTPDataError: (501, b’Syntax error - line too long’).
Are there any further debugging steps? On the email side?
A recent post on a PDF related topic indicated that an update of wkhtmltopdf and openssl libraries contributed to a workable solution. Perhaps between the SMTPS and openssl modules, there might be a glitch or incompatibility?
Error seems repeated for HTML containing emails. I enabled a daily email report with sales invoices outstanding - and it too has same SMTP error.
Do I need to file a bug report somewhere?
Was able to resolve problem by migrating env back to python2.7. Problem remains unresolved for higher versions of python environment
Thanks zerodiscount - I just saw this, no note on python version nor traceback https://github.com/frappe/erpnext/issues/12455
FWIW travis automated checkin tests run on 3.6
edit: correction apparently for now this runs 2.7 https://travis-ci.com/frappe/erpnext
whereas this runs 2.7 and 3.6 https://travis-ci.org/frappe/frappe
I tried 3.6 as well before reverting back to 2.7 - had same problem with 3.6. As I understand, the issue arises because HTML formatting needs an LF or CRLF - without which it seems to exceed the 1000 character limit for smtp… will stay on 2.7 until resolution (did so because of a discussion post where 3.5 seemed recommended for V11)
Tested again with v12.1.1 and Python3.6 - get same error. Seems unresolved as yet? Should revert back to Python2.7 as all email notifications with pdf attachments will not be sent…