Sending emails with Django is pretty straightforward. First, you will need to have a local SMTP server or define the configuration of an external SMTP server by adding the following settings in the settings.py file of your project:
- EMAIL_HOST: The SMTP server host; the default is localhost
- EMAIL_PORT: The SMTP port; the default is 25
- EMAIL_HOST_USER: Username for the SMTP server
- EMAIL_HOST_PASSWORD: Password for the SMTP server
- EMAIL_USE_TLS: Whether to use a TLS secure connection
- EMAIL_USE_SSL: Whether to use an implicit TLS secure connection
If you cannot use an SMTP server, you can tell Django to write emails to the console by adding the following setting to the settings.py file:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' ...