Search code examples
djangopinax

Django Create Account ends in 550


on a Django application (geonode 2.4) I´m trying to register a new user: [email protected]. This ends in ERROR SMTPRecipientsRefused [email protected] (550, unknown User).

The same Setup works on a local vm (with same SMTP server)!

SETUP

  • Ubuntu 14.04
  • Django 1.6.11
  • Accounts App: geonode-user-accounts (Forked from pinax-django-user-accounts)

SMTP local_settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = True
EMAIL_HOST = 'mail.example.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'pass'
EMAIL_PORT = 25 ## tested telnet to 587 but it seems only 25 is open
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
THEME_ACCOUNT_CONTACT_EMAIL = '[email protected]'

QUESTION

What I do not understand why does Django complain about [email protected] when I try to register [email protected]? – It should not care about already registered users. How can I debug this?

TRACEBACK

   SMTPRecipientsRefused at /account/signup/
    {u'[email protected]': (550, 'Unknown user')}
    Request Method: POST
    Request URL:    http://geonode.barbatti.org/account/signup/
    Django Version: 1.6.11
    Exception Type: SMTPRecipientsRefused
    Exception Value:    
    {u'[email protected]': (550, 'Unknown user')}
    Exception Location: /usr/lib/python2.7/smtplib.py in sendmail, line 747
    Python Executable:  /usr/bin/python
    Python Version: 2.7.6
    Python Path:    
    ['/var/www/geonode',
     '/usr/lib/python2.7',
     '/usr/lib/python2.7/plat-x86_64-linux-gnu',
     '/usr/lib/python2.7/lib-tk',
     '/usr/lib/python2.7/lib-old',
     '/usr/lib/python2.7/lib-dynload',
     '/usr/local/lib/python2.7/dist-packages',
     '/usr/lib/python2.7/dist-packages',
     '/usr/lib/python2.7/dist-packages/PILcompat',
     '/usr/lib/pymodules/python2.7',
     '/var/www']
    Server time:    Tue, 16 May 2017 09:52:13 -0500
    Traceback Switch to copy-and-paste view

    /usr/lib/python2.7/dist-packages/django/core/handlers/base.py in get_response
                        response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/views/generic/base.py in view
                return self.dispatch(request, *args, **kwargs) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/views/generic/base.py in dispatch
            return handler(request, *args, **kwargs) ...
    ▶ Local vars
    /usr/local/lib/python2.7/dist-packages/account/views.py in post
            return super(SignupView, self).post(*args, **kwargs) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/views/generic/edit.py in post
                return self.form_valid(form) ...
    ▶ Local vars
    /usr/local/lib/python2.7/dist-packages/account/views.py in form_valid
                notification.send(staff, "account_approve", {"from_user": self.created_user}) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/notification/models.py in send
                return send_now(*args, **kwargs) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/notification/models.py in send_now
                    backend.deliver(user, sender, notice_type, extra_context) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/notification/backends/email.py in deliver
            send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [recipient.email]) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/core/mail/__init__.py in send_mail
                            connection=connection).send() ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/core/mail/message.py in send
            return self.get_connection(fail_silently).send_messages([self]) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py in send_messages
                    sent = self._send(message) ...
    ▶ Local vars
    /usr/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py in _send
                self.connection.sendmail(from_email, recipients, message.as_bytes()) ...
    ▶ Local vars
    /usr/lib/python2.7/smtplib.py in sendmail
                raise SMTPRecipientsRefused(senderrs) ...

Solution

  • I found it, what happens here is that

    ACCOUNT_APPROVAL_REQUIRED = True
    

    is set. The mentioned yahoo adress is an admin, which should be informed for approval. The Smtp is refusing the adress and throwing the 550.