[Fixed]-Django send_mail() works from shell but not in nginx production


If the email is printed in the console then you have probably set

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

which prints the email instead of sending it.

If this line is included in an alternative (to the default) settings file then it could somehow be used by your deployment setup, whereas the shell continues to use the default settings file where the backend is either set to:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

or not set at all, in which case the default value is smtp as well

Leave a comment