0

Followed this question: Django registration email not sending but realized this is for https://github.com/macropin/django-registration not https://github.com/ubernostrum/django-registration which is what I need.

Unfortunately, there is nothing about this in their docs about SMTP: http://django-registration.readthedocs.io

ve is my app and I've tested my SMTP creds on a 3rd party app and I got an email just fine. Tried on localhost and live site as well.

settings.py

INSTALLED_APPS = [
    'registration',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    've',
    'widget_tweaks',
]

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = '***'
EMAIL_HOST_PASSWORD = '***'
EMAIL_HOST_USER = '***'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL  = 'noreply@***'

urls.py

from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('registration.backends.simple.urls')),
    url(r'', include('ve.urls',  namespace='ve')),
]


if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Alex Winkler
  • 469
  • 4
  • 25
  • `EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend` --> `EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'` You miss a `'` at the end. – allcaps Nov 20 '17 at 17:18
  • Try to isolate the issue. Change your backend to `EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'` and check if the mail is printed to console. If that works, it might be your email settings. Undo the EmailBackend change and fire up a shell. `python manage.py shell` and try to send a mail like this https://docs.djangoproject.com/en/1.11/topics/email/ – allcaps Nov 20 '17 at 17:27
  • @allcaps unfortunately that was a question copy issue only.. – Alex Winkler Nov 20 '17 at 17:47
  • @allcaps I get emails in my inbox using the Django method above in shell. I believe this issue is somewhere in the "pip install django-registration" app – Alex Winkler Nov 20 '17 at 17:57
  • Great! Nothing wrong with your email settings! But what about the console.EmailBackend? Do your django-registration mails get printed to console when you request a password reset? – allcaps Nov 20 '17 at 18:12
  • @allcaps when you say console you mean Command Prompt right? If that's the case it doesn't. Goes from: [20/Nov/2017 19:19:02] "POST /accounts/password/reset/ HTTP/1.1" 302 0 to [20/Nov/2017 19:19:02] "GET /accounts/password/reset/done/ HTTP/1.1" 200 1909 – Alex Winkler Nov 20 '17 at 18:19
  • Your urls are wrong. See my answer. – allcaps Nov 20 '17 at 18:20

1 Answers1

0

After continuously tinkering with this I decided to switch to the allauth Django package. After setting it up everything worked fine and I got much more desired functionality.

I know this is not the best solution as it does not fully answer the question above. However, it could be sort of an answer because switching to a more documented and current package is could also be the best idea.

Alex Winkler
  • 469
  • 4
  • 25