E-Mail settings do not work

I have a problem with sending and receiving E-Mails.

I have two test Systems. One on frappe cloud, and one local. I copied the databases from Frappe to the local machine.

I used to used email_delivery_service app on frappe cloud and deleted this manualy on the local host.

The E-Mail settings work on the cloud, but not on the local host.

I found a possible problem. In my user settings I found some third party Authentication, but I have it local, so I think there should be no Frappe visible. But I just can’t delete it. Every time I save the deleted version, it is back.

The error in the Email Queue says:

  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 166, in send
    message = ctx.build_message(recipient.recipient)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 312, in build_message
    message = self.include_attachments(message)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 385, in include_attachments
    print_format_file = frappe.attach_print(**attachment)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 2134, in attach_print
    else get_print(doctype, name, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 2093, in get_print
    return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 87, in get_pdf
    filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string
    return r.to_pdf(output_path)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
    self.handle_error(exit_code, stderr)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)

Does anybody have an idea why my email does not work?

I think I know why this is happening. You can’t just delete it from the list in the user document. They are likely linked to the User documents. You will need to delete the Social Login Key document itself. Try going to the list from the awesome bar “Social Login Key List” and deleting the relevant documents from there. Then they will not come back.

Thanks for your help, but “Social Login Key” is empty.

I do not know what the social login key is used for, but before migrating the databasis I deleted the email_delivery_service from frappe of my old databasis (The one from frappe cloud)

Actually, I noticed my system all has those frappe logins there for my users as well. And I’ve never used frappe cloud. When deleted, they are automatically regenerated (though with a different user id field every time). So I’m not sure what those are for, but I don’t think they are tied to your system having been on frappe cloud before. And since email sending and receiving works fine on my system, I don’t believe that field is the source of your email send-and-receive problems.

If I were you, I would check these documents and make sure they are set up properly (maybe even delete and recreate them if needed):

Then, make sure the email account docs are linked properly to the corresponding user docs.

Also, you may need to look into your wkhtmltopdf setup and make sure that’s correct, since that is what your traceback seems to be referencing. Can you send emails without attachments?

A developer helped me with the solution. In the site folder (frappe-bench/sites/xyt there is a site_config.json.

I added the server domain and then the email worked

That is a common fix for the wkhtmltopdf error. For reference, there is also a bench command that can add the domain into site_config.json without manual editing:

bench set-url-root SITE URL_ROOT