[solved] Unable to send Email

I’ve added Email (GMail) Account and set it as default outgoing.
I tried emailing Sales Order and there was error

Traceback (innermost last):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 67, in application
    response = frappe.handler.handle()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 74, in handle
    execute_cmd(cmd)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 99, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 758, in call
    return fn(*args, **newargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py", line 298, in make
    comm.send(print_html, print_format, attachments, send_me_a_copy=send_me_a_copy, recipients=recipients)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py", line 65, in send
    self.notify(print_html, print_format, attachments, recipients)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py", line 103, in notify
    recipients=recipients, except_recipient=except_recipient)
  File "/home/erpnext/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/erpnext/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/erpnext/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/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/amqp.py", line 305, in publish_task
    **kwargs
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/kombu/messaging.py", line 172, in publish
    routing_key, mandatory, immediate, exchange, declare)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py", line 457, in _ensured
    interval_max)
  File "/home/erpnext/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/erpnext/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/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py", line 237, in connect
    return self.connection
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py", line 741, in connection
    self._connection = self._establish_connection()
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/kombu/connection.py", line 696, in _establish_connection
    conn = self.transport.establish_connection()
  File "/home/erpnext/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/erpnext/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/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 443, in __init__
    self.client.info()
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py", line 657, in info
    return self.execute_command('INFO')
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py", line 570, in execute_command
    connection.send_command(*args)
  File "/home/erpnext/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/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", line 532, in send_packed_command
    self.connect()
  File "/home/erpnext/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.

redis-cache showed error so I followed thread Redis cache server error

erpnext@castlecraft-server:~$ sudo supervisorctl status
[sudo] password for erpnext: 
frappe:frappe-web                RUNNING    pid 2497, uptime 0:07:15
frappe:frappe-worker             RUNNING    pid 2496, uptime 0:07:15
frappe:frappe-workerbeat         RUNNING    pid 2498, uptime 0:07:15
node-socketio                    RUNNING    pid 2499, uptime 0:07:15
redis-async-broker               RUNNING    pid 2500, uptime 0:07:15
redis-cache                      RUNNING    pid 2930, uptime 0:05:57

Problem Solved:

There was /etc/nginx/redis.conf -> /home/erpnext/frappe-bench/config/redis.conf
I restored /etc/nginx/redis.conf back to original [1]

bench setup redis-cache

generates redis_cache.conf which works after removing line 6 [2]

[1] Redis cache server not running. Please contact Administrator / Tech support
[2] Redis cache server error

1 Like