I’m using django 2.2. with python 3.6. In some cases my server stores stdout into a log used by managers.
For some reason django started to write to stdout at send-mail some time ago. The managers do not like it because it looks like en error case for them.
So the following sends the e-mail, but also writes to stdout:
^C(venv) > python manage.py shell
Python 3.6.15 (default, Sep 15 2021, 12:00:00)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from django.core.mail import send_mail
In [2]: send_mail(
...: 'Problems in sync script',
...: "kukkuu",
...: 'pxpro_sync@<myOrg>',
...: ['<myEmail>'],
...: fail_silently = False,)
connection: {'fail_silently': False, 'host': 'localhost', 'port': 25, 'username': '', 'password': '', 'use_tls': False, 'use_ssl': False, 'timeout': None, 'ssl_keyfile': None, 'ssl_certfile': None, 'connection': None, '_lock': <unlocked _thread.RLock object owner=0 count=0 at 0x7fa8e5a01180>}
mail: <django.core.mail.message.EmailMultiAlternatives object at 0x7fa8e59b4ba8> <class 'django.core.mail.message.EmailMultiAlternatives'>
Out[2]: 1
How can I get just e-mails sent without anything (like “connection:…”) displayed into stdout ?