
Security News
TypeScript Native Previews: 10x Faster Compiler Now on npm for Public Testing
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.
django-emaillog-backend
Advanced tools
Django email backend that writes messages to logger instead of sending them by SMTP.
Simple email backend for Django that writes messages to logger instead of sending them to a SMTP server.
Installation is easy using pip
pip install django-emaillog-backend
To ensure that all emails sent using the send_mail function of Django are sent to a log you must add the following line to your settings.py
file:
EMAIL_BACKEND = 'django_emaillog_backend.backends.LoggerBackend'
You can specify the logger to which the logs will be sent adding it to the settings.py
file
EMAIL_LOGGER_NAME = 'your_logger_name'
For example, you can create a custom logger to test the correct behaviour of sending mails as follow:
# Add a custom logger to test mails
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
...
},
'handlers': {
...
},
'loggers': {
...
'email_logger': {
'handlers': ['your_handler'],
'propagate': True,
'level': 'DEBUG',
},
}
}
# Configure the email backend
EMAIL_BACKEND = 'django_emaillog_backend.backends.LoggerBackend'
EMAIL_LOGGER_NAME = 'email_logger'
The default logger for django-emaillog-backend
is the global Django logger called 'django'.
It is also possible to choose the severity level of messages sent to the logger adding the following to your settings.py
file:
EMAIL_LOGGER_LEVEL = logger_level
EMAIL_LOGGER_LEVEL
expects an integer. We recommend using the severity levels of the logging module:
logging.DEBUG (10)
logging.INFO (20)
logging.WARNING (30)
logging.ERROR (40)
logging.CRITICAL (50)
For example:
import logging
EMAIL_LOGGER_LEVEL = logging.INFO
The default log level is INFO
.
FAQs
Django email backend that writes messages to logger instead of sending them by SMTP.
We found that django-emaillog-backend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.
Research
Security News
Malicious npm packages targeting React, Vue, Vite, Node.js, and Quill remained undetected for two years while deploying destructive payloads.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.