Cannot send email from ERPNext - any suggestions?

This is the error message I always get:

Server Error: Please check your server logs or contact tech support. Traceback (innermost last):
File “/home/marcus/frappe-bench/apps/frappe/frappe/app.py”, line 69, in application
response = frappe.handler.handle()
File “/home/marcus/frappe-bench/apps/frappe/frappe/handler.py”, line 20, in handle
execute_cmd(cmd)
File “/home/marcus/frappe-bench/apps/frappe/frappe/handler.py”, line 37, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/marcus/frappe-bench/apps/frappe/frappe/init.py”, line 801, in call
return fn(*args, **newargs)
File “/home/marcus/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py”, line 390, in make
comm.send(print_html, print_format, attachments, send_me_a_copy=send_me_a_copy)
File “/home/marcus/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py”, line 84, in send
self.notify(print_html, print_format, attachments, recipients)
File “/home/marcus/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py”, line 113, in notify
recipients=recipients, cc=cc, lang=frappe.local.lang, session=frappe.local.session)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/task.py”, line 453, in delay
return self.apply_async(args, kwargs)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/task.py”, line 559, in apply_async
**dict(self._get_exec_options(), **options)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/base.py”, line 353, in send_task
reply_to=reply_to or self.oid, **options
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/amqp.py”, line 305, in publish_task
**kwargs
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/messaging.py”, line 172, in publish
routing_key, mandatory, immediate, exchange, declare)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py”, line 457, in _ensured
interval_max)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py”, line 369, in ensure_connection
interval_start, interval_step, interval_max, callback)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/utils/init.py”, line 243, in retry_over_time
return fun(*args, **kwargs)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py”, line 237, in connect
return self.connection
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py”, line 741, in connection
self._connection = self._establish_connection()
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py”, line 696, in _establish_connection
conn = self.transport.establish_connection()
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/transport/virtual/init.py”, line 809, in establish_connection
self._avail_channels.append(self.create_channel(self))
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/transport/virtual/init.py”, line 791, in create_channel
channel = self.Channel(connection)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/kombu/transport/redis.py”, line 443, in init
self.client.info()
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py”, line 657, in info
return self.execute_command(‘INFO’)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py”, line 570, in execute_command
connection.send_command(*args)
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py”, line 556, in send_command
self.send_packed_command(self.pack_command(*args))
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py”, line 532, in send_packed_command
self.connect()
File “/home/marcus/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py”, line 436, in connect
raise ConnectionError(self._error_message(e))
ConnectionError: Error 111 connecting to localhost:6379. Connection refused.

It seems app is trying to connect to your localhost on port 6379 which is standard port for redis.
Which Mail server you are using? You should also check your mail server log along with redis logs, if you are hosting it yourself.
Lastly you should also check if you have firewall enabled on server which might be blocking connections.

1 Like

Thank you very much, will try that.