Django not sending emails to admins












59















According to the documentation, if DEBUG is set to False and something is provided under the ADMINS setting, Django will send an email whenever the code raises a 500 status code. I have the email settings filled out properly (as I can use send_mail fine) but whenever I intentionally put up erroneous code I get my 500.html template but no error email is sent. What could cause Django to not do this?










share|improve this question



























    59















    According to the documentation, if DEBUG is set to False and something is provided under the ADMINS setting, Django will send an email whenever the code raises a 500 status code. I have the email settings filled out properly (as I can use send_mail fine) but whenever I intentionally put up erroneous code I get my 500.html template but no error email is sent. What could cause Django to not do this?










    share|improve this question

























      59












      59








      59


      8






      According to the documentation, if DEBUG is set to False and something is provided under the ADMINS setting, Django will send an email whenever the code raises a 500 status code. I have the email settings filled out properly (as I can use send_mail fine) but whenever I intentionally put up erroneous code I get my 500.html template but no error email is sent. What could cause Django to not do this?










      share|improve this question














      According to the documentation, if DEBUG is set to False and something is provided under the ADMINS setting, Django will send an email whenever the code raises a 500 status code. I have the email settings filled out properly (as I can use send_mail fine) but whenever I intentionally put up erroneous code I get my 500.html template but no error email is sent. What could cause Django to not do this?







      python django






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 12 '09 at 2:57







      JoseVega































          19 Answers
          19






          active

          oldest

          votes


















          91














          In my case the cause was missing SERVER_EMAIL setting.



          The default for SERVER_EMAIL is root@localhost. But many of email servers including
          my email provider do not accept emails from such suspicious addresses. They silently drop the emails.



          Changing the sender email address to django@my-domain.com solved the problem. In settings.py:



          SERVER_EMAIL = 'django@my-domain.com'





          share|improve this answer





















          • 2





            Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

            – jathanism
            Jun 25 '12 at 16:58





















          37














          Another possibility for error is trouble with your ADMINS setting. The following setting will cause the sending of mail to admins to fail quietly:



          ADMINS = (
          ('your name', 'me@mydomain.com')
          )


          What's wrong with that? Well ADMINS needs to be a tuple of tuples, so the above needs to be formatted as



          ADMINS = (
          ('your name', 'me@mydomain.com'),
          )


          Note the trailing comma. Without the failing comma, the 'to' address on the email will be incorrectly formatted (and then probably discarded silently by your SMTP server).






          share|improve this answer
























          • (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

            – wxgeorge
            Aug 8 '13 at 21:31





















          33














          I had the same situation. I created a new project and app and it worked, so I knew it was my code. I tracked it down to the LOGGING dictionary in settings.py. I had made some changes a few weeks back for logging with Sentry, but for some reason the error just started today. I changed back to the original and got it working:



          LOGGING = {
          'version': 1,
          'disable_existing_loggers': False,
          'handlers': {
          'mail_admins': {
          'level': 'ERROR',
          'class': 'django.utils.log.AdminEmailHandler'
          }
          },
          'loggers': {
          'django.request': {
          'handlers': ['mail_admins'],
          'level': 'ERROR',
          'propagate': True,
          },
          }
          }


          Then, I made some changes slowly and got it working with Sentry and emailing the ADMINS as well.



          Additionally, the LOGGING configuration gets merged with DEFAULT_LOGGING by default, so it's useful to have a look at the source code of django.utils.log.DEFAULT_LOGGING to understand what else may have an effect on your particular situation.






          share|improve this answer





















          • 3





            Under Django 1.4 this fixed it for us.

            – boatcoder
            Aug 31 '12 at 23:46











          • This fixed it for me (Django 1.7). Thanks

            – Paco
            Jan 7 '15 at 16:40






          • 1





            Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

            – guidos
            Mar 22 '16 at 16:22











          • Thanks! my problem was on 'propagate': False

            – Manel Clos
            Jan 8 '18 at 16:24











          • Great! Worked for me on Django 2.0

            – philoj
            Feb 7 at 7:00



















          16














          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.






          share|improve this answer



















          • 2





            I see the message, but if I set it back to my email settings it doesn't work

            – JoseVega
            Sep 12 '09 at 5:43











          • also added this, works well, but still nothing changes when set back to normal settings

            – Harry
            Sep 10 '15 at 13:11



















          6














          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.






          share|improve this answer



















          • 1





            I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

            – Dominic Rodger
            Sep 12 '09 at 6:47











          • That is, Django error e-mails get sent from googlemail.

            – Dominic Rodger
            Sep 12 '09 at 6:48






          • 1





            it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

            – JoseVega
            Sep 12 '09 at 7:49











          • This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

            – jenniwren
            May 1 '17 at 23:43



















          3














          Another thing worth noting here is that settings handler500 might bypass the mechanism that sends errors on a 500 if the response from the view doesn't have a status code of 500.
          If you have a handler500 set, then in that view respond with something like this.



          t = loader.get_template('500.html')
          response = HttpResponseServerError(
          t.render(RequestContext(request, {'custom_context_var':
          'IT BROKE OMG FIRE EVERYONE'})))
          response.status_code = 500
          return response





          share|improve this answer
























          • I'd added a custom 500 error page and this solved my problem. Thanks.

            – alstr
            Dec 7 '18 at 8:53



















          2














          Try this



          # ./manage shell
          >>> from django.core.mail import send_mail
          >>> send_mail('Subject here', 'Here is the message.', 'from@example.com',['to@example.com'], fail_silently=False)


          With a to@example.com that you actually get email at.






          share|improve this answer



















          • 3





            As I said, I already tried that and it works fine.

            – JoseVega
            Sep 12 '09 at 5:41



















          2














          Make sure you have DEBUG = False






          share|improve this answer































            2














            Sorry if it is too naive, but in my case the emails were sent but were going directly to the SPAM folder. Before trying more complicated things check your SPAM folder first.






            share|improve this answer
























            • Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

              – Mike S
              May 28 '14 at 17:36



















            1














            Although it's been a while, here's my response, so that other people can benefit in the future.



            In my case, what was preventing emails to be sent to the ADMINS list, when an error occured, was an application specific setting. I was using django-piston, which provides the setting attributes PISTON_EMAIL_ERRORS and PISTON_DISPLAY_ERRORS. Setting these accordingly, enabled the application server to notify my by mail, whenever piston would crash.






            share|improve this answer































              1














              If, for some reason, you set DEBUG_PROPAGATE_EXCEPTIONS to True (it's False by default), email to admin will not work.






              share|improve this answer































                1














                ... and then there's the facepalm error, when you've used this in development to prevent emails from going out, and then accidentally copy the setting to production:



                # Print emails to console
                EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


                (of course you don't see them being printed to console when using a wsgi server). Removing the setting from production fixed this for me.






                share|improve this answer































                  1














                  Just had the same issue after upgraded to Django 2.1 from Django 1.11. Apparently the ADMINS sections in settings.py has a change. It takes a list of tuples now, rather than the old tuple of tuples. This fixed for me.



                  ##### old #####
                  ADMINS = (
                  ("Your Name", "your_email@company.com")
                  )

                  ##### new #####
                  ADMINS = [
                  ("Your Name", "your_email@company.com")
                  ]


                  Re: https://docs.djangoproject.com/en/2.1/ref/settings/#admins






                  share|improve this answer































                    0














                    While likely not ideal, I have found using Gmail as the SMTP host works just fine. There is a useful guide at nathanostgard.com.



                    Feel free to post your relevant settings.py sections (including EMAIL_*, SERVER_EMAIL, ADMINS (just take out your real email), MANAGERS, and DEBUG) if you want an extra set of eyes to check for typos!






                    share|improve this answer































                      0














                      For what it's worth I had this issue and none of these suggestions worked for me. It turns out that my problem was that SERVER_EMAIL was set to an address that the server (Webfaction) didn't recognise. If this site were hosted on Webfaction (as my other sites are), this wouldn't be a problem, but as this was on a different server, the Webfaction servers not only check the authentication of the email being sent, but also the From: value as well.






                      share|improve this answer































                        0














                        In my case, it's the include_html in mail_admins.



                        When I set include_html to True,the email server reject to send my email because it think that my emails are spam.



                        Everything works just fine when I set include_html to False.






                        share|improve this answer































                          0














                          And yet another thing that can go wrong (I'll just add it to the list, for those people that end up here despite all the great answers above):



                          Our django setup used SendGrid as the smtp host and had a single admin email-address defined in the django settings. This worked fine for some time, but at some point, mails stopped arriving.



                          As it turns out, the mail address ended up in the SendGrid 'Bounced' list for some unknown reason, causing emails to that address to be silently dropped forever after. Removing the address from that list, and whitelisting it, fixed the issue.






                          share|improve this answer































                            0














                            If you are using or would want to use SendGrid, use the settings below in production.



                            Install the package



                            pip install sendgrid-django


                            Add these settings in settings.py(production)



                            DEBUG = False

                            EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"

                            SENDGRID_API_KEY = "That you generate in sendgrid account"

                            ADMINS = (
                            ("Your Name", "your_email@company.com")
                            )





                            share|improve this answer































                              0














                              The below info is given in https://docs.djangoproject.com/en/2.1/howto/error-reporting/#email-reports



                              EMAIL_HOST = "email host"

                              EMAIL_HOST_USER = "Email username"

                              EMAIL_HOST_PASSWORD = "Email Password"

                              DEBUG = False

                              ADMINS = (
                              ("Your Name", "your_email@company.com")
                              )



                              In order to send email, Django requires a few settings telling it how
                              to connect to your mail server. At the very least, you’ll need to
                              specify EMAIL_HOST and possibly EMAIL_HOST_USER and
                              EMAIL_HOST_PASSWORD, though other settings may be also required
                              depending on your mail server’s configuration. Consult the Django
                              settings documentation for a full list of email-related settings.







                              share|improve this answer























                                Your Answer






                                StackExchange.ifUsing("editor", function () {
                                StackExchange.using("externalEditor", function () {
                                StackExchange.using("snippets", function () {
                                StackExchange.snippets.init();
                                });
                                });
                                }, "code-snippets");

                                StackExchange.ready(function() {
                                var channelOptions = {
                                tags: "".split(" "),
                                id: "1"
                                };
                                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                                StackExchange.using("externalEditor", function() {
                                // Have to fire editor after snippets, if snippets enabled
                                if (StackExchange.settings.snippets.snippetsEnabled) {
                                StackExchange.using("snippets", function() {
                                createEditor();
                                });
                                }
                                else {
                                createEditor();
                                }
                                });

                                function createEditor() {
                                StackExchange.prepareEditor({
                                heartbeatType: 'answer',
                                autoActivateHeartbeat: false,
                                convertImagesToLinks: true,
                                noModals: true,
                                showLowRepImageUploadWarning: true,
                                reputationToPostImages: 10,
                                bindNavPrevention: true,
                                postfix: "",
                                imageUploader: {
                                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                                allowUrls: true
                                },
                                onDemand: true,
                                discardSelector: ".discard-answer"
                                ,immediatelyShowMarkdownHelp:true
                                });


                                }
                                });














                                draft saved

                                draft discarded


















                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1414130%2fdjango-not-sending-emails-to-admins%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown
























                                19 Answers
                                19






                                active

                                oldest

                                votes








                                19 Answers
                                19






                                active

                                oldest

                                votes









                                active

                                oldest

                                votes






                                active

                                oldest

                                votes









                                91














                                In my case the cause was missing SERVER_EMAIL setting.



                                The default for SERVER_EMAIL is root@localhost. But many of email servers including
                                my email provider do not accept emails from such suspicious addresses. They silently drop the emails.



                                Changing the sender email address to django@my-domain.com solved the problem. In settings.py:



                                SERVER_EMAIL = 'django@my-domain.com'





                                share|improve this answer





















                                • 2





                                  Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

                                  – jathanism
                                  Jun 25 '12 at 16:58


















                                91














                                In my case the cause was missing SERVER_EMAIL setting.



                                The default for SERVER_EMAIL is root@localhost. But many of email servers including
                                my email provider do not accept emails from such suspicious addresses. They silently drop the emails.



                                Changing the sender email address to django@my-domain.com solved the problem. In settings.py:



                                SERVER_EMAIL = 'django@my-domain.com'





                                share|improve this answer





















                                • 2





                                  Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

                                  – jathanism
                                  Jun 25 '12 at 16:58
















                                91












                                91








                                91







                                In my case the cause was missing SERVER_EMAIL setting.



                                The default for SERVER_EMAIL is root@localhost. But many of email servers including
                                my email provider do not accept emails from such suspicious addresses. They silently drop the emails.



                                Changing the sender email address to django@my-domain.com solved the problem. In settings.py:



                                SERVER_EMAIL = 'django@my-domain.com'





                                share|improve this answer















                                In my case the cause was missing SERVER_EMAIL setting.



                                The default for SERVER_EMAIL is root@localhost. But many of email servers including
                                my email provider do not accept emails from such suspicious addresses. They silently drop the emails.



                                Changing the sender email address to django@my-domain.com solved the problem. In settings.py:



                                SERVER_EMAIL = 'django@my-domain.com'






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Mar 28 '14 at 17:07









                                Radek Simko

                                5,507155697




                                5,507155697










                                answered Jul 1 '11 at 17:54









                                geekQgeekQ

                                23.5k84748




                                23.5k84748








                                • 2





                                  Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

                                  – jathanism
                                  Jun 25 '12 at 16:58
















                                • 2





                                  Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

                                  – jathanism
                                  Jun 25 '12 at 16:58










                                2




                                2





                                Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

                                – jathanism
                                Jun 25 '12 at 16:58







                                Another hint that this is likely the problem is if you check your mail log and see an entry containing sender non-delivery notification.

                                – jathanism
                                Jun 25 '12 at 16:58















                                37














                                Another possibility for error is trouble with your ADMINS setting. The following setting will cause the sending of mail to admins to fail quietly:



                                ADMINS = (
                                ('your name', 'me@mydomain.com')
                                )


                                What's wrong with that? Well ADMINS needs to be a tuple of tuples, so the above needs to be formatted as



                                ADMINS = (
                                ('your name', 'me@mydomain.com'),
                                )


                                Note the trailing comma. Without the failing comma, the 'to' address on the email will be incorrectly formatted (and then probably discarded silently by your SMTP server).






                                share|improve this answer
























                                • (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

                                  – wxgeorge
                                  Aug 8 '13 at 21:31


















                                37














                                Another possibility for error is trouble with your ADMINS setting. The following setting will cause the sending of mail to admins to fail quietly:



                                ADMINS = (
                                ('your name', 'me@mydomain.com')
                                )


                                What's wrong with that? Well ADMINS needs to be a tuple of tuples, so the above needs to be formatted as



                                ADMINS = (
                                ('your name', 'me@mydomain.com'),
                                )


                                Note the trailing comma. Without the failing comma, the 'to' address on the email will be incorrectly formatted (and then probably discarded silently by your SMTP server).






                                share|improve this answer
























                                • (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

                                  – wxgeorge
                                  Aug 8 '13 at 21:31
















                                37












                                37








                                37







                                Another possibility for error is trouble with your ADMINS setting. The following setting will cause the sending of mail to admins to fail quietly:



                                ADMINS = (
                                ('your name', 'me@mydomain.com')
                                )


                                What's wrong with that? Well ADMINS needs to be a tuple of tuples, so the above needs to be formatted as



                                ADMINS = (
                                ('your name', 'me@mydomain.com'),
                                )


                                Note the trailing comma. Without the failing comma, the 'to' address on the email will be incorrectly formatted (and then probably discarded silently by your SMTP server).






                                share|improve this answer













                                Another possibility for error is trouble with your ADMINS setting. The following setting will cause the sending of mail to admins to fail quietly:



                                ADMINS = (
                                ('your name', 'me@mydomain.com')
                                )


                                What's wrong with that? Well ADMINS needs to be a tuple of tuples, so the above needs to be formatted as



                                ADMINS = (
                                ('your name', 'me@mydomain.com'),
                                )


                                Note the trailing comma. Without the failing comma, the 'to' address on the email will be incorrectly formatted (and then probably discarded silently by your SMTP server).







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Aug 8 '13 at 21:30









                                wxgeorgewxgeorge

                                39347




                                39347













                                • (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

                                  – wxgeorge
                                  Aug 8 '13 at 21:31





















                                • (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

                                  – wxgeorge
                                  Aug 8 '13 at 21:31



















                                (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

                                – wxgeorge
                                Aug 8 '13 at 21:31







                                (It was thanks to @cathal 's answer above running a debugging SMTP server locally that allowed me to locate this as my problem).

                                – wxgeorge
                                Aug 8 '13 at 21:31













                                33














                                I had the same situation. I created a new project and app and it worked, so I knew it was my code. I tracked it down to the LOGGING dictionary in settings.py. I had made some changes a few weeks back for logging with Sentry, but for some reason the error just started today. I changed back to the original and got it working:



                                LOGGING = {
                                'version': 1,
                                'disable_existing_loggers': False,
                                'handlers': {
                                'mail_admins': {
                                'level': 'ERROR',
                                'class': 'django.utils.log.AdminEmailHandler'
                                }
                                },
                                'loggers': {
                                'django.request': {
                                'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True,
                                },
                                }
                                }


                                Then, I made some changes slowly and got it working with Sentry and emailing the ADMINS as well.



                                Additionally, the LOGGING configuration gets merged with DEFAULT_LOGGING by default, so it's useful to have a look at the source code of django.utils.log.DEFAULT_LOGGING to understand what else may have an effect on your particular situation.






                                share|improve this answer





















                                • 3





                                  Under Django 1.4 this fixed it for us.

                                  – boatcoder
                                  Aug 31 '12 at 23:46











                                • This fixed it for me (Django 1.7). Thanks

                                  – Paco
                                  Jan 7 '15 at 16:40






                                • 1





                                  Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

                                  – guidos
                                  Mar 22 '16 at 16:22











                                • Thanks! my problem was on 'propagate': False

                                  – Manel Clos
                                  Jan 8 '18 at 16:24











                                • Great! Worked for me on Django 2.0

                                  – philoj
                                  Feb 7 at 7:00
















                                33














                                I had the same situation. I created a new project and app and it worked, so I knew it was my code. I tracked it down to the LOGGING dictionary in settings.py. I had made some changes a few weeks back for logging with Sentry, but for some reason the error just started today. I changed back to the original and got it working:



                                LOGGING = {
                                'version': 1,
                                'disable_existing_loggers': False,
                                'handlers': {
                                'mail_admins': {
                                'level': 'ERROR',
                                'class': 'django.utils.log.AdminEmailHandler'
                                }
                                },
                                'loggers': {
                                'django.request': {
                                'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True,
                                },
                                }
                                }


                                Then, I made some changes slowly and got it working with Sentry and emailing the ADMINS as well.



                                Additionally, the LOGGING configuration gets merged with DEFAULT_LOGGING by default, so it's useful to have a look at the source code of django.utils.log.DEFAULT_LOGGING to understand what else may have an effect on your particular situation.






                                share|improve this answer





















                                • 3





                                  Under Django 1.4 this fixed it for us.

                                  – boatcoder
                                  Aug 31 '12 at 23:46











                                • This fixed it for me (Django 1.7). Thanks

                                  – Paco
                                  Jan 7 '15 at 16:40






                                • 1





                                  Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

                                  – guidos
                                  Mar 22 '16 at 16:22











                                • Thanks! my problem was on 'propagate': False

                                  – Manel Clos
                                  Jan 8 '18 at 16:24











                                • Great! Worked for me on Django 2.0

                                  – philoj
                                  Feb 7 at 7:00














                                33












                                33








                                33







                                I had the same situation. I created a new project and app and it worked, so I knew it was my code. I tracked it down to the LOGGING dictionary in settings.py. I had made some changes a few weeks back for logging with Sentry, but for some reason the error just started today. I changed back to the original and got it working:



                                LOGGING = {
                                'version': 1,
                                'disable_existing_loggers': False,
                                'handlers': {
                                'mail_admins': {
                                'level': 'ERROR',
                                'class': 'django.utils.log.AdminEmailHandler'
                                }
                                },
                                'loggers': {
                                'django.request': {
                                'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True,
                                },
                                }
                                }


                                Then, I made some changes slowly and got it working with Sentry and emailing the ADMINS as well.



                                Additionally, the LOGGING configuration gets merged with DEFAULT_LOGGING by default, so it's useful to have a look at the source code of django.utils.log.DEFAULT_LOGGING to understand what else may have an effect on your particular situation.






                                share|improve this answer















                                I had the same situation. I created a new project and app and it worked, so I knew it was my code. I tracked it down to the LOGGING dictionary in settings.py. I had made some changes a few weeks back for logging with Sentry, but for some reason the error just started today. I changed back to the original and got it working:



                                LOGGING = {
                                'version': 1,
                                'disable_existing_loggers': False,
                                'handlers': {
                                'mail_admins': {
                                'level': 'ERROR',
                                'class': 'django.utils.log.AdminEmailHandler'
                                }
                                },
                                'loggers': {
                                'django.request': {
                                'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True,
                                },
                                }
                                }


                                Then, I made some changes slowly and got it working with Sentry and emailing the ADMINS as well.



                                Additionally, the LOGGING configuration gets merged with DEFAULT_LOGGING by default, so it's useful to have a look at the source code of django.utils.log.DEFAULT_LOGGING to understand what else may have an effect on your particular situation.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Nov 14 '16 at 17:32

























                                answered Mar 2 '12 at 23:08









                                FurbeenatorFurbeenator

                                5,11243146




                                5,11243146








                                • 3





                                  Under Django 1.4 this fixed it for us.

                                  – boatcoder
                                  Aug 31 '12 at 23:46











                                • This fixed it for me (Django 1.7). Thanks

                                  – Paco
                                  Jan 7 '15 at 16:40






                                • 1





                                  Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

                                  – guidos
                                  Mar 22 '16 at 16:22











                                • Thanks! my problem was on 'propagate': False

                                  – Manel Clos
                                  Jan 8 '18 at 16:24











                                • Great! Worked for me on Django 2.0

                                  – philoj
                                  Feb 7 at 7:00














                                • 3





                                  Under Django 1.4 this fixed it for us.

                                  – boatcoder
                                  Aug 31 '12 at 23:46











                                • This fixed it for me (Django 1.7). Thanks

                                  – Paco
                                  Jan 7 '15 at 16:40






                                • 1





                                  Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

                                  – guidos
                                  Mar 22 '16 at 16:22











                                • Thanks! my problem was on 'propagate': False

                                  – Manel Clos
                                  Jan 8 '18 at 16:24











                                • Great! Worked for me on Django 2.0

                                  – philoj
                                  Feb 7 at 7:00








                                3




                                3





                                Under Django 1.4 this fixed it for us.

                                – boatcoder
                                Aug 31 '12 at 23:46





                                Under Django 1.4 this fixed it for us.

                                – boatcoder
                                Aug 31 '12 at 23:46













                                This fixed it for me (Django 1.7). Thanks

                                – Paco
                                Jan 7 '15 at 16:40





                                This fixed it for me (Django 1.7). Thanks

                                – Paco
                                Jan 7 '15 at 16:40




                                1




                                1





                                Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

                                – guidos
                                Mar 22 '16 at 16:22





                                Adding logging settings killed my admin emails, which worked fine before with default logging. I assumed disable_existing_loggers': False would keep existing logging as is, but it didn't. This fixed it.

                                – guidos
                                Mar 22 '16 at 16:22













                                Thanks! my problem was on 'propagate': False

                                – Manel Clos
                                Jan 8 '18 at 16:24





                                Thanks! my problem was on 'propagate': False

                                – Manel Clos
                                Jan 8 '18 at 16:24













                                Great! Worked for me on Django 2.0

                                – philoj
                                Feb 7 at 7:00





                                Great! Worked for me on Django 2.0

                                – philoj
                                Feb 7 at 7:00











                                16














                                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.






                                share|improve this answer



















                                • 2





                                  I see the message, but if I set it back to my email settings it doesn't work

                                  – JoseVega
                                  Sep 12 '09 at 5:43











                                • also added this, works well, but still nothing changes when set back to normal settings

                                  – Harry
                                  Sep 10 '15 at 13:11
















                                16














                                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.






                                share|improve this answer



















                                • 2





                                  I see the message, but if I set it back to my email settings it doesn't work

                                  – JoseVega
                                  Sep 12 '09 at 5:43











                                • also added this, works well, but still nothing changes when set back to normal settings

                                  – Harry
                                  Sep 10 '15 at 13:11














                                16












                                16








                                16







                                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.






                                share|improve this answer













                                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.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 12 '09 at 3:06









                                CathalCathal

                                26614




                                26614








                                • 2





                                  I see the message, but if I set it back to my email settings it doesn't work

                                  – JoseVega
                                  Sep 12 '09 at 5:43











                                • also added this, works well, but still nothing changes when set back to normal settings

                                  – Harry
                                  Sep 10 '15 at 13:11














                                • 2





                                  I see the message, but if I set it back to my email settings it doesn't work

                                  – JoseVega
                                  Sep 12 '09 at 5:43











                                • also added this, works well, but still nothing changes when set back to normal settings

                                  – Harry
                                  Sep 10 '15 at 13:11








                                2




                                2





                                I see the message, but if I set it back to my email settings it doesn't work

                                – JoseVega
                                Sep 12 '09 at 5:43





                                I see the message, but if I set it back to my email settings it doesn't work

                                – JoseVega
                                Sep 12 '09 at 5:43













                                also added this, works well, but still nothing changes when set back to normal settings

                                – Harry
                                Sep 10 '15 at 13:11





                                also added this, works well, but still nothing changes when set back to normal settings

                                – Harry
                                Sep 10 '15 at 13:11











                                6














                                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.






                                share|improve this answer



















                                • 1





                                  I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:47











                                • That is, Django error e-mails get sent from googlemail.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:48






                                • 1





                                  it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

                                  – JoseVega
                                  Sep 12 '09 at 7:49











                                • This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

                                  – jenniwren
                                  May 1 '17 at 23:43
















                                6














                                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.






                                share|improve this answer



















                                • 1





                                  I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:47











                                • That is, Django error e-mails get sent from googlemail.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:48






                                • 1





                                  it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

                                  – JoseVega
                                  Sep 12 '09 at 7:49











                                • This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

                                  – jenniwren
                                  May 1 '17 at 23:43














                                6












                                6








                                6







                                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.






                                share|improve this answer













                                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.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 12 '09 at 5:52







                                JoseVega















                                • 1





                                  I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:47











                                • That is, Django error e-mails get sent from googlemail.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:48






                                • 1





                                  it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

                                  – JoseVega
                                  Sep 12 '09 at 7:49











                                • This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

                                  – jenniwren
                                  May 1 '17 at 23:43














                                • 1





                                  I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:47











                                • That is, Django error e-mails get sent from googlemail.

                                  – Dominic Rodger
                                  Sep 12 '09 at 6:48






                                • 1





                                  it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

                                  – JoseVega
                                  Sep 12 '09 at 7:49











                                • This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

                                  – jenniwren
                                  May 1 '17 at 23:43








                                1




                                1





                                I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

                                – Dominic Rodger
                                Sep 12 '09 at 6:47





                                I use webfaction and send e-mails from googlemail, so I don't think that was really the problem.

                                – Dominic Rodger
                                Sep 12 '09 at 6:47













                                That is, Django error e-mails get sent from googlemail.

                                – Dominic Rodger
                                Sep 12 '09 at 6:48





                                That is, Django error e-mails get sent from googlemail.

                                – Dominic Rodger
                                Sep 12 '09 at 6:48




                                1




                                1





                                it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

                                – JoseVega
                                Sep 12 '09 at 7:49





                                it obviously allows you to send emails if you're using google's smtp server, but if you use smtp.webfaction.com as the host then it won't let you unless the email exists. I didn't change anything else and it fixed it so I'm pretty sure that was it.

                                – JoseVega
                                Sep 12 '09 at 7:49













                                This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

                                – jenniwren
                                May 1 '17 at 23:43





                                This fixed the problem for me, too. I am using the telus smpt server and just switched it to authenticated as opposed to not. It worked before the change and to make it work now I had to use an e-mail address that exists to send from.

                                – jenniwren
                                May 1 '17 at 23:43











                                3














                                Another thing worth noting here is that settings handler500 might bypass the mechanism that sends errors on a 500 if the response from the view doesn't have a status code of 500.
                                If you have a handler500 set, then in that view respond with something like this.



                                t = loader.get_template('500.html')
                                response = HttpResponseServerError(
                                t.render(RequestContext(request, {'custom_context_var':
                                'IT BROKE OMG FIRE EVERYONE'})))
                                response.status_code = 500
                                return response





                                share|improve this answer
























                                • I'd added a custom 500 error page and this solved my problem. Thanks.

                                  – alstr
                                  Dec 7 '18 at 8:53
















                                3














                                Another thing worth noting here is that settings handler500 might bypass the mechanism that sends errors on a 500 if the response from the view doesn't have a status code of 500.
                                If you have a handler500 set, then in that view respond with something like this.



                                t = loader.get_template('500.html')
                                response = HttpResponseServerError(
                                t.render(RequestContext(request, {'custom_context_var':
                                'IT BROKE OMG FIRE EVERYONE'})))
                                response.status_code = 500
                                return response





                                share|improve this answer
























                                • I'd added a custom 500 error page and this solved my problem. Thanks.

                                  – alstr
                                  Dec 7 '18 at 8:53














                                3












                                3








                                3







                                Another thing worth noting here is that settings handler500 might bypass the mechanism that sends errors on a 500 if the response from the view doesn't have a status code of 500.
                                If you have a handler500 set, then in that view respond with something like this.



                                t = loader.get_template('500.html')
                                response = HttpResponseServerError(
                                t.render(RequestContext(request, {'custom_context_var':
                                'IT BROKE OMG FIRE EVERYONE'})))
                                response.status_code = 500
                                return response





                                share|improve this answer













                                Another thing worth noting here is that settings handler500 might bypass the mechanism that sends errors on a 500 if the response from the view doesn't have a status code of 500.
                                If you have a handler500 set, then in that view respond with something like this.



                                t = loader.get_template('500.html')
                                response = HttpResponseServerError(
                                t.render(RequestContext(request, {'custom_context_var':
                                'IT BROKE OMG FIRE EVERYONE'})))
                                response.status_code = 500
                                return response






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Jan 22 '15 at 23:48









                                oliversealoliverseal

                                575614




                                575614













                                • I'd added a custom 500 error page and this solved my problem. Thanks.

                                  – alstr
                                  Dec 7 '18 at 8:53



















                                • I'd added a custom 500 error page and this solved my problem. Thanks.

                                  – alstr
                                  Dec 7 '18 at 8:53

















                                I'd added a custom 500 error page and this solved my problem. Thanks.

                                – alstr
                                Dec 7 '18 at 8:53





                                I'd added a custom 500 error page and this solved my problem. Thanks.

                                – alstr
                                Dec 7 '18 at 8:53











                                2














                                Try this



                                # ./manage shell
                                >>> from django.core.mail import send_mail
                                >>> send_mail('Subject here', 'Here is the message.', 'from@example.com',['to@example.com'], fail_silently=False)


                                With a to@example.com that you actually get email at.






                                share|improve this answer



















                                • 3





                                  As I said, I already tried that and it works fine.

                                  – JoseVega
                                  Sep 12 '09 at 5:41
















                                2














                                Try this



                                # ./manage shell
                                >>> from django.core.mail import send_mail
                                >>> send_mail('Subject here', 'Here is the message.', 'from@example.com',['to@example.com'], fail_silently=False)


                                With a to@example.com that you actually get email at.






                                share|improve this answer



















                                • 3





                                  As I said, I already tried that and it works fine.

                                  – JoseVega
                                  Sep 12 '09 at 5:41














                                2












                                2








                                2







                                Try this



                                # ./manage shell
                                >>> from django.core.mail import send_mail
                                >>> send_mail('Subject here', 'Here is the message.', 'from@example.com',['to@example.com'], fail_silently=False)


                                With a to@example.com that you actually get email at.






                                share|improve this answer













                                Try this



                                # ./manage shell
                                >>> from django.core.mail import send_mail
                                >>> send_mail('Subject here', 'Here is the message.', 'from@example.com',['to@example.com'], fail_silently=False)


                                With a to@example.com that you actually get email at.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 12 '09 at 5:09









                                Paul TarjanPaul Tarjan

                                24.1k49149203




                                24.1k49149203








                                • 3





                                  As I said, I already tried that and it works fine.

                                  – JoseVega
                                  Sep 12 '09 at 5:41














                                • 3





                                  As I said, I already tried that and it works fine.

                                  – JoseVega
                                  Sep 12 '09 at 5:41








                                3




                                3





                                As I said, I already tried that and it works fine.

                                – JoseVega
                                Sep 12 '09 at 5:41





                                As I said, I already tried that and it works fine.

                                – JoseVega
                                Sep 12 '09 at 5:41











                                2














                                Make sure you have DEBUG = False






                                share|improve this answer




























                                  2














                                  Make sure you have DEBUG = False






                                  share|improve this answer


























                                    2












                                    2








                                    2







                                    Make sure you have DEBUG = False






                                    share|improve this answer













                                    Make sure you have DEBUG = False







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 25 '09 at 2:04









                                    Tim BabychTim Babych

                                    2,76811510




                                    2,76811510























                                        2














                                        Sorry if it is too naive, but in my case the emails were sent but were going directly to the SPAM folder. Before trying more complicated things check your SPAM folder first.






                                        share|improve this answer
























                                        • Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

                                          – Mike S
                                          May 28 '14 at 17:36
















                                        2














                                        Sorry if it is too naive, but in my case the emails were sent but were going directly to the SPAM folder. Before trying more complicated things check your SPAM folder first.






                                        share|improve this answer
























                                        • Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

                                          – Mike S
                                          May 28 '14 at 17:36














                                        2












                                        2








                                        2







                                        Sorry if it is too naive, but in my case the emails were sent but were going directly to the SPAM folder. Before trying more complicated things check your SPAM folder first.






                                        share|improve this answer













                                        Sorry if it is too naive, but in my case the emails were sent but were going directly to the SPAM folder. Before trying more complicated things check your SPAM folder first.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Dec 2 '13 at 9:08









                                        MiquelMiquel

                                        570716




                                        570716













                                        • Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

                                          – Mike S
                                          May 28 '14 at 17:36



















                                        • Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

                                          – Mike S
                                          May 28 '14 at 17:36

















                                        Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

                                        – Mike S
                                        May 28 '14 at 17:36





                                        Actually.. yea. I had errors from crawlers trying to make an AJAX request without form data. I overestimated the intelligence of spam filters and ended up with all email sent by Django being caught by the spam filter.

                                        – Mike S
                                        May 28 '14 at 17:36











                                        1














                                        Although it's been a while, here's my response, so that other people can benefit in the future.



                                        In my case, what was preventing emails to be sent to the ADMINS list, when an error occured, was an application specific setting. I was using django-piston, which provides the setting attributes PISTON_EMAIL_ERRORS and PISTON_DISPLAY_ERRORS. Setting these accordingly, enabled the application server to notify my by mail, whenever piston would crash.






                                        share|improve this answer




























                                          1














                                          Although it's been a while, here's my response, so that other people can benefit in the future.



                                          In my case, what was preventing emails to be sent to the ADMINS list, when an error occured, was an application specific setting. I was using django-piston, which provides the setting attributes PISTON_EMAIL_ERRORS and PISTON_DISPLAY_ERRORS. Setting these accordingly, enabled the application server to notify my by mail, whenever piston would crash.






                                          share|improve this answer


























                                            1












                                            1








                                            1







                                            Although it's been a while, here's my response, so that other people can benefit in the future.



                                            In my case, what was preventing emails to be sent to the ADMINS list, when an error occured, was an application specific setting. I was using django-piston, which provides the setting attributes PISTON_EMAIL_ERRORS and PISTON_DISPLAY_ERRORS. Setting these accordingly, enabled the application server to notify my by mail, whenever piston would crash.






                                            share|improve this answer













                                            Although it's been a while, here's my response, so that other people can benefit in the future.



                                            In my case, what was preventing emails to be sent to the ADMINS list, when an error occured, was an application specific setting. I was using django-piston, which provides the setting attributes PISTON_EMAIL_ERRORS and PISTON_DISPLAY_ERRORS. Setting these accordingly, enabled the application server to notify my by mail, whenever piston would crash.







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Dec 9 '11 at 13:29









                                            Charalambos PaschalidesCharalambos Paschalides

                                            3051513




                                            3051513























                                                1














                                                If, for some reason, you set DEBUG_PROPAGATE_EXCEPTIONS to True (it's False by default), email to admin will not work.






                                                share|improve this answer




























                                                  1














                                                  If, for some reason, you set DEBUG_PROPAGATE_EXCEPTIONS to True (it's False by default), email to admin will not work.






                                                  share|improve this answer


























                                                    1












                                                    1








                                                    1







                                                    If, for some reason, you set DEBUG_PROPAGATE_EXCEPTIONS to True (it's False by default), email to admin will not work.






                                                    share|improve this answer













                                                    If, for some reason, you set DEBUG_PROPAGATE_EXCEPTIONS to True (it's False by default), email to admin will not work.







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Apr 23 '13 at 9:45









                                                    Dominique PerettiDominique Peretti

                                                    10112




                                                    10112























                                                        1














                                                        ... and then there's the facepalm error, when you've used this in development to prevent emails from going out, and then accidentally copy the setting to production:



                                                        # Print emails to console
                                                        EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


                                                        (of course you don't see them being printed to console when using a wsgi server). Removing the setting from production fixed this for me.






                                                        share|improve this answer




























                                                          1














                                                          ... and then there's the facepalm error, when you've used this in development to prevent emails from going out, and then accidentally copy the setting to production:



                                                          # Print emails to console
                                                          EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


                                                          (of course you don't see them being printed to console when using a wsgi server). Removing the setting from production fixed this for me.






                                                          share|improve this answer


























                                                            1












                                                            1








                                                            1







                                                            ... and then there's the facepalm error, when you've used this in development to prevent emails from going out, and then accidentally copy the setting to production:



                                                            # Print emails to console
                                                            EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


                                                            (of course you don't see them being printed to console when using a wsgi server). Removing the setting from production fixed this for me.






                                                            share|improve this answer













                                                            ... and then there's the facepalm error, when you've used this in development to prevent emails from going out, and then accidentally copy the setting to production:



                                                            # Print emails to console
                                                            EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


                                                            (of course you don't see them being printed to console when using a wsgi server). Removing the setting from production fixed this for me.







                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered Apr 22 '15 at 18:23









                                                            shackershacker

                                                            8,34455560




                                                            8,34455560























                                                                1














                                                                Just had the same issue after upgraded to Django 2.1 from Django 1.11. Apparently the ADMINS sections in settings.py has a change. It takes a list of tuples now, rather than the old tuple of tuples. This fixed for me.



                                                                ##### old #####
                                                                ADMINS = (
                                                                ("Your Name", "your_email@company.com")
                                                                )

                                                                ##### new #####
                                                                ADMINS = [
                                                                ("Your Name", "your_email@company.com")
                                                                ]


                                                                Re: https://docs.djangoproject.com/en/2.1/ref/settings/#admins






                                                                share|improve this answer




























                                                                  1














                                                                  Just had the same issue after upgraded to Django 2.1 from Django 1.11. Apparently the ADMINS sections in settings.py has a change. It takes a list of tuples now, rather than the old tuple of tuples. This fixed for me.



                                                                  ##### old #####
                                                                  ADMINS = (
                                                                  ("Your Name", "your_email@company.com")
                                                                  )

                                                                  ##### new #####
                                                                  ADMINS = [
                                                                  ("Your Name", "your_email@company.com")
                                                                  ]


                                                                  Re: https://docs.djangoproject.com/en/2.1/ref/settings/#admins






                                                                  share|improve this answer


























                                                                    1












                                                                    1








                                                                    1







                                                                    Just had the same issue after upgraded to Django 2.1 from Django 1.11. Apparently the ADMINS sections in settings.py has a change. It takes a list of tuples now, rather than the old tuple of tuples. This fixed for me.



                                                                    ##### old #####
                                                                    ADMINS = (
                                                                    ("Your Name", "your_email@company.com")
                                                                    )

                                                                    ##### new #####
                                                                    ADMINS = [
                                                                    ("Your Name", "your_email@company.com")
                                                                    ]


                                                                    Re: https://docs.djangoproject.com/en/2.1/ref/settings/#admins






                                                                    share|improve this answer













                                                                    Just had the same issue after upgraded to Django 2.1 from Django 1.11. Apparently the ADMINS sections in settings.py has a change. It takes a list of tuples now, rather than the old tuple of tuples. This fixed for me.



                                                                    ##### old #####
                                                                    ADMINS = (
                                                                    ("Your Name", "your_email@company.com")
                                                                    )

                                                                    ##### new #####
                                                                    ADMINS = [
                                                                    ("Your Name", "your_email@company.com")
                                                                    ]


                                                                    Re: https://docs.djangoproject.com/en/2.1/ref/settings/#admins







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Nov 20 '18 at 22:31









                                                                    Click2DeathClick2Death

                                                                    15819




                                                                    15819























                                                                        0














                                                                        While likely not ideal, I have found using Gmail as the SMTP host works just fine. There is a useful guide at nathanostgard.com.



                                                                        Feel free to post your relevant settings.py sections (including EMAIL_*, SERVER_EMAIL, ADMINS (just take out your real email), MANAGERS, and DEBUG) if you want an extra set of eyes to check for typos!






                                                                        share|improve this answer




























                                                                          0














                                                                          While likely not ideal, I have found using Gmail as the SMTP host works just fine. There is a useful guide at nathanostgard.com.



                                                                          Feel free to post your relevant settings.py sections (including EMAIL_*, SERVER_EMAIL, ADMINS (just take out your real email), MANAGERS, and DEBUG) if you want an extra set of eyes to check for typos!






                                                                          share|improve this answer


























                                                                            0












                                                                            0








                                                                            0







                                                                            While likely not ideal, I have found using Gmail as the SMTP host works just fine. There is a useful guide at nathanostgard.com.



                                                                            Feel free to post your relevant settings.py sections (including EMAIL_*, SERVER_EMAIL, ADMINS (just take out your real email), MANAGERS, and DEBUG) if you want an extra set of eyes to check for typos!






                                                                            share|improve this answer













                                                                            While likely not ideal, I have found using Gmail as the SMTP host works just fine. There is a useful guide at nathanostgard.com.



                                                                            Feel free to post your relevant settings.py sections (including EMAIL_*, SERVER_EMAIL, ADMINS (just take out your real email), MANAGERS, and DEBUG) if you want an extra set of eyes to check for typos!







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered Sep 12 '09 at 6:25









                                                                            John PaulettJohn Paulett

                                                                            13.4k33936




                                                                            13.4k33936























                                                                                0














                                                                                For what it's worth I had this issue and none of these suggestions worked for me. It turns out that my problem was that SERVER_EMAIL was set to an address that the server (Webfaction) didn't recognise. If this site were hosted on Webfaction (as my other sites are), this wouldn't be a problem, but as this was on a different server, the Webfaction servers not only check the authentication of the email being sent, but also the From: value as well.






                                                                                share|improve this answer




























                                                                                  0














                                                                                  For what it's worth I had this issue and none of these suggestions worked for me. It turns out that my problem was that SERVER_EMAIL was set to an address that the server (Webfaction) didn't recognise. If this site were hosted on Webfaction (as my other sites are), this wouldn't be a problem, but as this was on a different server, the Webfaction servers not only check the authentication of the email being sent, but also the From: value as well.






                                                                                  share|improve this answer


























                                                                                    0












                                                                                    0








                                                                                    0







                                                                                    For what it's worth I had this issue and none of these suggestions worked for me. It turns out that my problem was that SERVER_EMAIL was set to an address that the server (Webfaction) didn't recognise. If this site were hosted on Webfaction (as my other sites are), this wouldn't be a problem, but as this was on a different server, the Webfaction servers not only check the authentication of the email being sent, but also the From: value as well.






                                                                                    share|improve this answer













                                                                                    For what it's worth I had this issue and none of these suggestions worked for me. It turns out that my problem was that SERVER_EMAIL was set to an address that the server (Webfaction) didn't recognise. If this site were hosted on Webfaction (as my other sites are), this wouldn't be a problem, but as this was on a different server, the Webfaction servers not only check the authentication of the email being sent, but also the From: value as well.







                                                                                    share|improve this answer












                                                                                    share|improve this answer



                                                                                    share|improve this answer










                                                                                    answered Aug 16 '14 at 21:44









                                                                                    Daniel QuinnDaniel Quinn

                                                                                    2,02732539




                                                                                    2,02732539























                                                                                        0














                                                                                        In my case, it's the include_html in mail_admins.



                                                                                        When I set include_html to True,the email server reject to send my email because it think that my emails are spam.



                                                                                        Everything works just fine when I set include_html to False.






                                                                                        share|improve this answer




























                                                                                          0














                                                                                          In my case, it's the include_html in mail_admins.



                                                                                          When I set include_html to True,the email server reject to send my email because it think that my emails are spam.



                                                                                          Everything works just fine when I set include_html to False.






                                                                                          share|improve this answer


























                                                                                            0












                                                                                            0








                                                                                            0







                                                                                            In my case, it's the include_html in mail_admins.



                                                                                            When I set include_html to True,the email server reject to send my email because it think that my emails are spam.



                                                                                            Everything works just fine when I set include_html to False.






                                                                                            share|improve this answer













                                                                                            In my case, it's the include_html in mail_admins.



                                                                                            When I set include_html to True,the email server reject to send my email because it think that my emails are spam.



                                                                                            Everything works just fine when I set include_html to False.







                                                                                            share|improve this answer












                                                                                            share|improve this answer



                                                                                            share|improve this answer










                                                                                            answered Apr 8 '15 at 2:22









                                                                                            shellbyeshellbye

                                                                                            2,49522036




                                                                                            2,49522036























                                                                                                0














                                                                                                And yet another thing that can go wrong (I'll just add it to the list, for those people that end up here despite all the great answers above):



                                                                                                Our django setup used SendGrid as the smtp host and had a single admin email-address defined in the django settings. This worked fine for some time, but at some point, mails stopped arriving.



                                                                                                As it turns out, the mail address ended up in the SendGrid 'Bounced' list for some unknown reason, causing emails to that address to be silently dropped forever after. Removing the address from that list, and whitelisting it, fixed the issue.






                                                                                                share|improve this answer




























                                                                                                  0














                                                                                                  And yet another thing that can go wrong (I'll just add it to the list, for those people that end up here despite all the great answers above):



                                                                                                  Our django setup used SendGrid as the smtp host and had a single admin email-address defined in the django settings. This worked fine for some time, but at some point, mails stopped arriving.



                                                                                                  As it turns out, the mail address ended up in the SendGrid 'Bounced' list for some unknown reason, causing emails to that address to be silently dropped forever after. Removing the address from that list, and whitelisting it, fixed the issue.






                                                                                                  share|improve this answer


























                                                                                                    0












                                                                                                    0








                                                                                                    0







                                                                                                    And yet another thing that can go wrong (I'll just add it to the list, for those people that end up here despite all the great answers above):



                                                                                                    Our django setup used SendGrid as the smtp host and had a single admin email-address defined in the django settings. This worked fine for some time, but at some point, mails stopped arriving.



                                                                                                    As it turns out, the mail address ended up in the SendGrid 'Bounced' list for some unknown reason, causing emails to that address to be silently dropped forever after. Removing the address from that list, and whitelisting it, fixed the issue.






                                                                                                    share|improve this answer













                                                                                                    And yet another thing that can go wrong (I'll just add it to the list, for those people that end up here despite all the great answers above):



                                                                                                    Our django setup used SendGrid as the smtp host and had a single admin email-address defined in the django settings. This worked fine for some time, but at some point, mails stopped arriving.



                                                                                                    As it turns out, the mail address ended up in the SendGrid 'Bounced' list for some unknown reason, causing emails to that address to be silently dropped forever after. Removing the address from that list, and whitelisting it, fixed the issue.







                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered Oct 2 '17 at 16:42









                                                                                                    djvgdjvg

                                                                                                    1,1511728




                                                                                                    1,1511728























                                                                                                        0














                                                                                                        If you are using or would want to use SendGrid, use the settings below in production.



                                                                                                        Install the package



                                                                                                        pip install sendgrid-django


                                                                                                        Add these settings in settings.py(production)



                                                                                                        DEBUG = False

                                                                                                        EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"

                                                                                                        SENDGRID_API_KEY = "That you generate in sendgrid account"

                                                                                                        ADMINS = (
                                                                                                        ("Your Name", "your_email@company.com")
                                                                                                        )





                                                                                                        share|improve this answer




























                                                                                                          0














                                                                                                          If you are using or would want to use SendGrid, use the settings below in production.



                                                                                                          Install the package



                                                                                                          pip install sendgrid-django


                                                                                                          Add these settings in settings.py(production)



                                                                                                          DEBUG = False

                                                                                                          EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"

                                                                                                          SENDGRID_API_KEY = "That you generate in sendgrid account"

                                                                                                          ADMINS = (
                                                                                                          ("Your Name", "your_email@company.com")
                                                                                                          )





                                                                                                          share|improve this answer


























                                                                                                            0












                                                                                                            0








                                                                                                            0







                                                                                                            If you are using or would want to use SendGrid, use the settings below in production.



                                                                                                            Install the package



                                                                                                            pip install sendgrid-django


                                                                                                            Add these settings in settings.py(production)



                                                                                                            DEBUG = False

                                                                                                            EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"

                                                                                                            SENDGRID_API_KEY = "That you generate in sendgrid account"

                                                                                                            ADMINS = (
                                                                                                            ("Your Name", "your_email@company.com")
                                                                                                            )





                                                                                                            share|improve this answer













                                                                                                            If you are using or would want to use SendGrid, use the settings below in production.



                                                                                                            Install the package



                                                                                                            pip install sendgrid-django


                                                                                                            Add these settings in settings.py(production)



                                                                                                            DEBUG = False

                                                                                                            EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"

                                                                                                            SENDGRID_API_KEY = "That you generate in sendgrid account"

                                                                                                            ADMINS = (
                                                                                                            ("Your Name", "your_email@company.com")
                                                                                                            )






                                                                                                            share|improve this answer












                                                                                                            share|improve this answer



                                                                                                            share|improve this answer










                                                                                                            answered Aug 10 '18 at 5:20









                                                                                                            SuperNovaSuperNova

                                                                                                            5,83022921




                                                                                                            5,83022921























                                                                                                                0














                                                                                                                The below info is given in https://docs.djangoproject.com/en/2.1/howto/error-reporting/#email-reports



                                                                                                                EMAIL_HOST = "email host"

                                                                                                                EMAIL_HOST_USER = "Email username"

                                                                                                                EMAIL_HOST_PASSWORD = "Email Password"

                                                                                                                DEBUG = False

                                                                                                                ADMINS = (
                                                                                                                ("Your Name", "your_email@company.com")
                                                                                                                )



                                                                                                                In order to send email, Django requires a few settings telling it how
                                                                                                                to connect to your mail server. At the very least, you’ll need to
                                                                                                                specify EMAIL_HOST and possibly EMAIL_HOST_USER and
                                                                                                                EMAIL_HOST_PASSWORD, though other settings may be also required
                                                                                                                depending on your mail server’s configuration. Consult the Django
                                                                                                                settings documentation for a full list of email-related settings.







                                                                                                                share|improve this answer




























                                                                                                                  0














                                                                                                                  The below info is given in https://docs.djangoproject.com/en/2.1/howto/error-reporting/#email-reports



                                                                                                                  EMAIL_HOST = "email host"

                                                                                                                  EMAIL_HOST_USER = "Email username"

                                                                                                                  EMAIL_HOST_PASSWORD = "Email Password"

                                                                                                                  DEBUG = False

                                                                                                                  ADMINS = (
                                                                                                                  ("Your Name", "your_email@company.com")
                                                                                                                  )



                                                                                                                  In order to send email, Django requires a few settings telling it how
                                                                                                                  to connect to your mail server. At the very least, you’ll need to
                                                                                                                  specify EMAIL_HOST and possibly EMAIL_HOST_USER and
                                                                                                                  EMAIL_HOST_PASSWORD, though other settings may be also required
                                                                                                                  depending on your mail server’s configuration. Consult the Django
                                                                                                                  settings documentation for a full list of email-related settings.







                                                                                                                  share|improve this answer


























                                                                                                                    0












                                                                                                                    0








                                                                                                                    0







                                                                                                                    The below info is given in https://docs.djangoproject.com/en/2.1/howto/error-reporting/#email-reports



                                                                                                                    EMAIL_HOST = "email host"

                                                                                                                    EMAIL_HOST_USER = "Email username"

                                                                                                                    EMAIL_HOST_PASSWORD = "Email Password"

                                                                                                                    DEBUG = False

                                                                                                                    ADMINS = (
                                                                                                                    ("Your Name", "your_email@company.com")
                                                                                                                    )



                                                                                                                    In order to send email, Django requires a few settings telling it how
                                                                                                                    to connect to your mail server. At the very least, you’ll need to
                                                                                                                    specify EMAIL_HOST and possibly EMAIL_HOST_USER and
                                                                                                                    EMAIL_HOST_PASSWORD, though other settings may be also required
                                                                                                                    depending on your mail server’s configuration. Consult the Django
                                                                                                                    settings documentation for a full list of email-related settings.







                                                                                                                    share|improve this answer













                                                                                                                    The below info is given in https://docs.djangoproject.com/en/2.1/howto/error-reporting/#email-reports



                                                                                                                    EMAIL_HOST = "email host"

                                                                                                                    EMAIL_HOST_USER = "Email username"

                                                                                                                    EMAIL_HOST_PASSWORD = "Email Password"

                                                                                                                    DEBUG = False

                                                                                                                    ADMINS = (
                                                                                                                    ("Your Name", "your_email@company.com")
                                                                                                                    )



                                                                                                                    In order to send email, Django requires a few settings telling it how
                                                                                                                    to connect to your mail server. At the very least, you’ll need to
                                                                                                                    specify EMAIL_HOST and possibly EMAIL_HOST_USER and
                                                                                                                    EMAIL_HOST_PASSWORD, though other settings may be also required
                                                                                                                    depending on your mail server’s configuration. Consult the Django
                                                                                                                    settings documentation for a full list of email-related settings.








                                                                                                                    share|improve this answer












                                                                                                                    share|improve this answer



                                                                                                                    share|improve this answer










                                                                                                                    answered Aug 10 '18 at 5:23









                                                                                                                    SuperNovaSuperNova

                                                                                                                    5,83022921




                                                                                                                    5,83022921






























                                                                                                                        draft saved

                                                                                                                        draft discarded




















































                                                                                                                        Thanks for contributing an answer to Stack Overflow!


                                                                                                                        • Please be sure to answer the question. Provide details and share your research!

                                                                                                                        But avoid



                                                                                                                        • Asking for help, clarification, or responding to other answers.

                                                                                                                        • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                        To learn more, see our tips on writing great answers.




                                                                                                                        draft saved


                                                                                                                        draft discarded














                                                                                                                        StackExchange.ready(
                                                                                                                        function () {
                                                                                                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1414130%2fdjango-not-sending-emails-to-admins%23new-answer', 'question_page');
                                                                                                                        }
                                                                                                                        );

                                                                                                                        Post as a guest















                                                                                                                        Required, but never shown





















































                                                                                                                        Required, but never shown














                                                                                                                        Required, but never shown












                                                                                                                        Required, but never shown







                                                                                                                        Required, but never shown

































                                                                                                                        Required, but never shown














                                                                                                                        Required, but never shown












                                                                                                                        Required, but never shown







                                                                                                                        Required, but never shown







                                                                                                                        Popular posts from this blog

                                                                                                                        How to change which sound is reproduced for terminal bell?

                                                                                                                        Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                                                                                                        Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents