Django not sending emails to admins

后端 未结 20 1110
梦如初夏
梦如初夏 2020-12-08 08:54

According to the documentation, if DEBUG is set to False and something is provided under the ADMINS setting, Django will send an email

相关标签:
20条回答
  • 2020-12-08 09:44

    Make sure your EMAIL_HOST and EMAIL_PORT are set up right in settings.py (these refer to your SMTP server). It might be assuming that you have an SMTP server running on localhost.

    To test this locally, run Python's built-in test SMTP server:

    python -m smtpd -n -c DebuggingServer localhost:1025
    

    Then set these values in your settings.py

    EMAIL_HOST='localhost'
    EMAIL_PORT=1025
    

    Trigger a 500 error, and you should see the e-mail appear in the python smtpd terminal window.

    0 讨论(0)
  • 2020-12-08 09:47

    My web hosting provider - Webfaction - only allows emails to be sent From an email that has been explicitly created in the administrator panel. Creating one fixed the problem.

    0 讨论(0)
提交回复
热议问题