Django not sending emails to admins

后端 未结 20 1141
梦如初夏
梦如初夏 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.

提交回复
热议问题