[Errno 99] Cannot assign requested address

When things don't work as they should.
Post Reply
stev
Posts: 4
Joined: Thu Nov 28, 2019 12:25 am

[Errno 99] Cannot assign requested address

Post by stev » Thu Nov 28, 2019 12:35 am

I am trying to configure my Mayan EDMS container to send emails, however it is unable to open a socket connection. The error occurs on socket.py, line 575 in the create_connection method. Does anybody have any ideas how to resolve this?

Code: Select all

root@b9854e1e37f4:/# /opt/mayan-edms/bin/mayan-edms.py sendtestemail mail@mydomain.ca
Traceback (most recent call last):
  File "/opt/mayan-edms/bin/mayan-edms.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/commands/sendtestemail.py", line 33, in handle
    recipient_list=kwargs['email'],
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
    return mail.send()
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/mail/message.py", line 348, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 104, in send_messages
    new_conn_created = self.open()
  File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 64, in open
    self.connection = self.connection_class(self.host, self.port, **connection_params)
  File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 316, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
socket.error: [Errno 99] Cannot assign requested address

stev
Posts: 4
Joined: Thu Nov 28, 2019 12:25 am

Re: [Errno 99] Cannot assign requested address

Post by stev » Thu Nov 28, 2019 12:57 am

I should note... This is working from within Mayan for sending links. It does not work for 'admin' emails (i.e. password reset requests).

User avatar
rosarior
Posts: 457
Joined: Tue Aug 21, 2018 3:28 am

Re: [Errno 99] Cannot assign requested address

Post by rosarior » Thu Nov 28, 2019 5:26 am

Execute the showsettings command and see if the settings starting with "EMAIL_" are being picked up from the config.yml file.

Code: Select all

/opt/mayan-edms/bin/mayan-edms.py showsettings
Also try passing the MEDIA_ROOT environment to make sure the config.yml file is read:

Code: Select all

MAYAN_MEDIA_ROOT=/opt/mayan-edms/media /opt/mayan-edms/bin/mayan-edms.py showsettings

stev
Posts: 4
Joined: Thu Nov 28, 2019 12:25 am

Re: [Errno 99] Cannot assign requested address

Post by stev » Fri Nov 29, 2019 1:05 pm

The email settings appear to be correct when I run the command. These are the same settings I used in the mailer setup inside Mayan that worked.

Code: Select all

EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST: smtp.gmail.com
EMAIL_HOST_PASSWORD: REDACTED
EMAIL_HOST_USER: REDACTED@DOMAIN.COM
EMAIL_PORT: '587'
EMAIL_TIMEOUT: null
EMAIL_USE_SSL: false
EMAIL_USE_TLS: 'true'

Post Reply