yournextrepresentative
yournextrepresentative copied to clipboard
Connection Refused when sending email
I attempted to set up a user account in YNR and the server started giving error 500 on all YNR pages (Django admin works). I have apache set up through wsgi and it was working previously. I believe the issue is with sending email. After this error I added email settings at the bottom of general.yml as follows. What can I do now to get things running again?
EMAIL_HOST: 'smtp.gmail.com' EMAIL_HOST_USER: '[email protected]' EMAIL_HOST_PASSWORD: 'password' EMAIL_PORT: 465 EMAIL_USE_SSL: True
[Wed Jun 08 19:24:19.846023 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] mod_wsgi (pid=1657): Exception occurred processing WSGI script '/html/songolt/mysite/wsgi.py'.
[Wed Jun 08 19:24:19.846100 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] Traceback (most recent call last):
[Wed Jun 08 19:24:19.846124 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 189, in __call__
[Wed Jun 08 19:24:19.846156 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] response = self.get_response(request)
[Wed Jun 08 19:24:19.846173 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 218, in get_response
[Wed Jun 08 19:24:19.846196 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Wed Jun 08 19:24:19.846210 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 256, in handle_uncaught_exception
[Wed Jun 08 19:24:19.846232 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] 'request': request
[Wed Jun 08 19:24:19.846247 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
[Wed Jun 08 19:24:19.846272 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self._log(ERROR, msg, args, **kwargs)
[Wed Jun 08 19:24:19.846287 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/logging/__init__.py", line 1271, in _log
[Wed Jun 08 19:24:19.846309 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self.handle(record)
[Wed Jun 08 19:24:19.846324 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/logging/__init__.py", line 1281, in handle
[Wed Jun 08 19:24:19.846345 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self.callHandlers(record)
[Wed Jun 08 19:24:19.846359 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/logging/__init__.py", line 1321, in callHandlers
[Wed Jun 08 19:24:19.846380 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] hdlr.handle(record)
[Wed Jun 08 19:24:19.846394 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/logging/__init__.py", line 749, in handle
[Wed Jun 08 19:24:19.846415 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self.emit(record)
[Wed Jun 08 19:24:19.846430 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 129, in emit
[Wed Jun 08 19:24:19.846469 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self.send_mail(subject, message, fail_silently=True, html_message=html_message)
[Wed Jun 08 19:24:19.846484 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 132, in send_mail
[Wed Jun 08 19:24:19.846505 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
[Wed Jun 08 19:24:19.846520 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", line 98, in mail_admins
[Wed Jun 08 19:24:19.846542 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] mail.send(fail_silently=fail_silently)
[Wed Jun 08 19:24:19.846556 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 303, in send
[Wed Jun 08 19:24:19.846577 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] return self.get_connection(fail_silently).send_messages([self])
[Wed Jun 08 19:24:19.846592 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 100, in send_messages
[Wed Jun 08 19:24:19.846614 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] new_conn_created = self.open()
[Wed Jun 08 19:24:19.846628 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 58, in open
[Wed Jun 08 19:24:19.846649 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self.connection = connection_class(self.host, self.port, **connection_params)
[Wed Jun 08 19:24:19.846663 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
[Wed Jun 08 19:24:19.846685 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] (code, msg) = self.connect(host, port)
[Wed Jun 08 19:24:19.846698 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/smtplib.py", line 316, in connect
[Wed Jun 08 19:24:19.846718 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] self.sock = self._get_socket(host, port, self.timeout)
[Wed Jun 08 19:24:19.846732 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
[Wed Jun 08 19:24:19.846752 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] return socket.create_connection((host, port), timeout)
[Wed Jun 08 19:24:19.846766 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] File "/usr/lib/python2.7/socket.py", line 571, in create_connection
[Wed Jun 08 19:24:19.846787 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] raise err
[Wed Jun 08 19:24:19.846809 2016] [:error] [pid 1657:tid 140100714301184] [client 162.158.95.16:52960] error: [Errno 111] Connection refused
The YAML config only accepts a few options; pending a resolution to #890, the easiest thing to do here would be to add the email settings inside mysite/settings/local_settings.py:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 465
EMAIL_USE_SSL = True